PyTorch
The most popular deep-learning framework: dynamic graphs, Pythonic API, huge ecosystem.
Intermediate
import torch
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
for xb, yb in loader:
loss = loss_fn(model(xb), yb)
opt.zero_grad(); loss.backward(); opt.step()
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.