eazygrad.tensor

eazygrad.tensor(array: Any, requires_grad: bool = False, dtype: Any = None) _Tensor[source]

Create a tensor from a Python scalar, list, or NumPy array.

Parameters:
  • array (scalar, list, or numpy.ndarray) – Input data used to build the tensor.

  • requires_grad (bool, default=False) – Whether to track operations on the returned tensor for automatic differentiation.

  • dtype (numpy.dtype or type, optional) – Requested tensor dtype. If omitted, the dtype is inferred from the input.

Returns:

_Tensor – Newly created tensor.

Notes

Unlike from_numpy(), this constructor copies NumPy inputs.

See also

torch.tensor