We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Easy
Framework
Stack Tensors
Stack a list of 1D tensors into a 2D tensor along a new first dimension.
Unlike concatenation, stacking creates a new dimension.
Input:
-
tensors: A list of 1D tensors, each of shape(n,)
Output: A 2D tensor of shape (len(tensors), n).
API Reference:
-
PyTorch:
torch.stack(tensors, dim=0) -
JAX:
jnp.stack(tensors, axis=0)
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.