def randint(low, high, size, dtype="int64", requires_grad=False): return Tensor( fluid.layers.randint(low, high=high, shape=size, out=None, dtype=dtype, device=None, stop_gradient=not requires_grad))
def rand(*shape): if isinstance(shape, int): shape = [shape] if isinstance(shape[0], Iterable): shape = shape[0] return Tensor(paddle.rand(shape))
def matmul(x, y): return Tensor(fluid.layers.matmul(x, y))
def dot(x, y): return Tensor(fluid.layers.dot(x, y))
def sigmoid(x): return Tensor(fluid.layers.sigmoid(x))
def bmm(x, y): return Tensor(fluid.layers.bmm(x, y))
def arange(*args, **kwargs): return Tensor(np.arange(*args, **kwargs).astype("int32"))
def flip(self, dim): return Tensor(paddle.flip(self, dims=[dim]))
def trace(x, offset=0, dim1=0, dim2=1, out=None): return Tensor(paddle.trace(x, offset, dim1, dim2, out))
def bmm(x, y, transpose=False): if transpose: y = y.transpose(len(y.shape) - 1, len(y.shape) - 2) return Tensor(paddle.bmm(x, y))
def eye(n, m=None): if m is None: m = n return Tensor(paddle.eye(n, m))
def from_numpy(x): return Tensor(x)
def LongTensor(x): if isinstance(x, int): return Tensor(paddle.to_tensor([x])) if isinstance(x, list): x = paddle.to_tensor(x, dtype="int64") return convertTensor(x.astype("int64"))
def floor(x): return Tensor(paddle.floor(x))
def flip(self, dim): return Tensor(fluid.layers.flip(self, dims=[dim]))
def bmm(x, y): return Tensor(paddle.bmm(x, y))
def linspace(start, stop, num, dtype="float32"): return Tensor(fluid.layers.linspace(start, stop, num, dtype))
def eye(n, m): return Tensor(paddle.eye(n, m))
def LongTensor(x): if isinstance(x, int): return Tensor(fluid.Tensor) if isinstance(x, list): x = np.array(x, dtype=np.int32) return Tensor(x)
def dot(x, y): return Tensor(paddle.dot(x, y))
def trace(x, offset=0, dim1=0, dim2=1, out=None): return Tensor(fluid.layers.trace(x, offset, dim1, dim2, out))
def squeeze(x, axes=[-1]): return Tensor(paddle.squeeze(x, axes))
def eye(n, m): return Tensor(fluid.layers.eye(n, m))
def matmul(x, y): return Tensor(paddle.matmul(x, y))
def tanh(x): return Tensor(fluid.layers.tanh(x))
def full_like(x, fill_value): return Tensor.new_full(x, x.shape, fill_value)
def squeeze(x, axes=[-1]): return Tensor(fluid.layers.squeeze(x, axes))
def norm(input, p="fro", dim=None, keepdim=False, out=None, dtype=None): from . import linalg return Tensor(linalg.norm(input, p=p, axis=dim, keepdim=keepdim, name=None))
def tensor(x, dtype=np.float32): if isinstance(x, list): x = np.array(x, dtype=dtype) if isinstance(x, int) or isinstance(x, np.int64): return zeros(x) return Tensor(x)
def randint(low, high, size=[1], dtype="int32", requires_grad=False): return Tensor( paddle.randint(low=low, high=high, shape=size, dtype=dtype, name=None))