Пример #1
0
def read(var):
  assert isinstance(var, py_defaults.Variable)
  if isinstance(var.val, torch.Tensor):
    return tf.constant(var.val.numpy())
  return py_defaults.read(var)
Пример #2
0
def read(var):
  hnd = _handler(var, '__read__')
  if hnd is not None:
    return hnd(var)
  else:
    return py_defaults.read(var)
Пример #3
0
def read(var):
    assert isinstance(var, py_defaults.Variable)
    if tf.is_tensor(var.val):
        return var.val.numpy()
    return py_defaults.read(var)
Пример #4
0
def read(var):
    assert isinstance(var, py_defaults.Variable)
    if isinstance(var.val, np.ndarray):
        return jnp.array(var.val)
    return py_defaults.read(var)
Пример #5
0
 def read(self, var):
     return py_defaults.read(var)