ASCI Logo
ASCI.Academy
LearnPracticeCompeteCareer
Sign InGet Started

Search ASCI Academy

Universal search across Courses, Lessons, Skills, Projects, Challenges, Competitions, Jobs, Internships, and Users

meta pytorch-llama3

Curriculum Index

Current LevelInitiate
0/ 500 XP
Gravit Certificate:
100% Required
  • 1.1 Forward Pass & Gradient Computation in Python
•
1
2
3
4
5
6
7
8
9
10
Module 1: PyTorch Autograd & Computational Graph•Lesson 1

1.1 Forward Pass & Gradient Computation in Python

### Analytical Gradient Calculation
For a linear prediction $\hat{y} = w \cdot x + b$ and MSE loss $L = (\hat{y} - y)^2$:

$$\frac{\partial L}{\partial w} = 2 \cdot (\hat{y} - y) \cdot x$$
Python 3.11
•
Interactive Challenge
+50 XP
Challenge Objective

Compute the linear loss and weight gradient and print 'LOSS: 4.0, GRAD_W: 8.0'.

solution.py
UTF-84 SpacesAuto-saved
cpython3.11:~/workspace
CPython 3.11.8 (WASM)
$python3 -u solution.py
Click "Compile & Run" (or press Ctrl + Enter) to compile AST, verify bytecode, and execute the solution.