torch.tensor()
TENSOR FUNDAMENTALSCreates a tensor from data like lists, arrays, or scalars. It's the most common way to create tensors in PyTorch and the foundation for all neural network operations.
Syntax:
torch.tensor(data, dtype=None, device=None, requires_grad=False)
Use Cases:
Converting Python lists/arrays to PyTorch tensors for model input