torch.asarray
torch.asarray(obj, *, dtype=None, device=None, copy=None, requires_grad=False) -> Tensor
Converts "obj" to a tensor.
"obj" can be one of:


a tensor


a NumPy array


a DLPack capsule


an object that implements Python's buffer protocol


a scalar


a sequence of scalars


When "obj" is a tensor, NumPy array, or DLPack capsule the returned
   tensor will, by default, not require a gradient, have the same
   datatype as "obj", be on the same device, and share memory with it.
   These properties can be controlled with the "dtype", "device",
   "copy", and "requires_grad" keyword arguments. If the returned
   tensor is of a different datatype, on a different device, or a copy
   is requested then it will not share its memory with "obj". If
   "requires_grad" is "True" then the returned tensor will require a
   gradient, and if "obj" is also a tensor with an autograd history
   then the returned tensor will have the same history.