easy framework

Reshape a Tensor

Reshape a tensor to a given target shape without changing its data.

Input:

  • x: A tensor
  • shape: A list of integers representing the target shape

Output: A tensor with the same data but reshaped to the target dimensions.

API Reference:

  • PyTorch: x.reshape(shape) or torch.reshape(x, shape)
  • JAX: jnp.reshape(x, shape) or x.reshape(shape)

Hints

reshape tensor-manipulation torch.reshape jnp.reshape
Detecting runtime...