pytorch in 1 hour

.shape โ†’ a tuple describing the dimensions #1 debugging tool .device โ†’ where the tensor lives. cpu or cuda (GPU) .dtype โ†’ the data type of the numbers. The default is float32 (because of backprop and gradients)

model weights and biases โ†’ float32 (standard)

Autograd - Automatic Differentiation

  • it is pythonโ€™s built in gradient calculator, and can be turned on using requires_grad=True
  • to tell pytorch a tensor is a learnable param we must set requires_grad=True, doing so pytorch tracks every single operation on that tensor!

The difference between * and @ in pytorch

  • for @ multiplication m1 col = m2 rows

  • when building a linear layer always use @ โ†’ y = X@W + b

dim arg

selecting data - basic and custom

making forward pass

  • modelโ€™s first guess
  • simple linear regression ลท = XW + b The magic command - loss.backward()
    • calculates the gradient of the loss wrt to our weight โ€œWโ€
    • the gradient of the loss wrt to our Bias โ€˜bโ€™

202609072031