We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Tensor Foundations
PyTorchThe basics of working with tensors — shapes, indexing, broadcasting, and the operations you'll reach for daily.
7 exercises
Explore freely. Sign in to keep your progress.
Your learning sequence
- 1 Not solved yet. Create a Tensor from a List Practice · Easy
- 2 Not solved yet. Reshape a Tensor Practice · Easy
- 3 Not solved yet. Transpose a Matrix Practice · Easy
- 4 Not solved yet. Broadcasting Addition Practice · Easy
- 5 Not solved yet. Tensor Indexing and Slicing Practice · Easy
- 6 Not solved yet. Masked Fill Practice · Medium
- 7 Not solved yet. Concatenate Tensors Practice · Easy
Check yourself
4 questions · not saved while you're signed outUse these questions to check your understanding and compare explanations. Your score does not affect track completion.
With deterministic filling disabled, what can you assume about x before fill_ runs?
Choose one answer to reveal the explanations. Answers are kept only while this page is open.
import torch
torch.use_deterministic_algorithms(False)
x = torch.empty(3)
# Initialize every element before reading its value.
x.fill_(2.0)
print(x.tolist())
print(torch.zeros(3).tolist())