44. Install PyTorch and First Tensors
44.3 Create and Shape Tensors
44.3 Create आणि shape tensors
Shape bugs नेच beginners crash होतात. view/reshape हळू practice.
हे का शिकायचं?
Why. Shape bugs नेच बहुतेक beginner crashes. view/reshape हळूच practice करा.
हे काय आहे?
What. reshape / view numbers ची गटवारी बदलतात, count नाही. Batch dimension सहसा first: (batch, features).
कसं करायचं?
How.
Shapes शी खेळा
- Length-6 vector create करा.
- (2, 3) मध्ये reshape.
- 4 rows × 3 features चा batch add करा.
import torch
v = torch.arange(6.0)
print(v.reshape(2, 3))
batch = torch.randn(4, 3)
print("batch shape", batch.shape)
Output / जे दिसायला हवं. 2×3 matrix आणि 4×3 batch — mini-batches वर training करताना हाच pattern.