Ravindra BagaleCourses & study guides English Track your progress

44. Install PyTorch and First Tensors

Data Science

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 शी खेळा

  1. Length-6 vector create करा.
  2. (2, 3) मध्ये reshape.
  3. 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.