We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Tensor Foundations step 2 of 7
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)ortorch.reshape(x, shape) -
JAX:
jnp.reshape(x, shape)orx.reshape(shape)Loading visualization…
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.