Skip to content

← Tensor Foundations step 1 of 7

Easy Framework

Create a Tensor from a List

Create a tensor from a nested Python list using the framework’s tensor constructor.

Input: A nested list data representing a 2D matrix.

Output: A 2D tensor with the same values.

API Reference:

  • PyTorch: torch.tensor(data)
  • JAX: jnp.array(data)