Torch + Pyodide
Load example:
-- custom --
basic_ops.py
no_grad.py
linear_model.py
training_sgd.py
custom_module.py
x = torch.tensor([1.0, 2.0, 3.0], requires_grad=True) y = torch.tensor([4.0, 5.0, 6.0], requires_grad=True) z = (x * y).sum() z.backward() print("x.grad:", x.grad) print("y.grad:", y.grad)
Run Code
Clear
Output: