Function
step
(tensor, optim, steps=1, teeny=False, **kwargs)
Source from the content-addressed store, hash-verified
| 34 | return out |
| 35 | |
| 36 | def step(tensor, optim, steps=1, teeny=False, **kwargs): |
| 37 | net = TeenyNet(tensor) if teeny else TinyNet(tensor) |
| 38 | optim = optim([net.x, net.W], **kwargs) |
| 39 | for _ in range(steps): |
| 40 | out = net.forward() |
| 41 | optim.zero_grad() |
| 42 | out.backward() |
| 43 | optim.step() |
| 44 | return net.x.detach().numpy(), net.W.detach().numpy() |
| 45 | |
| 46 | @slow |
| 47 | class TestOptim(unittest.TestCase): |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…