(self)
| 133 | # TODO: this is failing because of how swizzling rewrites the ShapeTracker of the final STORE |
| 134 | @unittest.skipIf(CI and Device.DEFAULT == "DSP", "failing because of make things that can't be images not images") |
| 135 | def test_mnist_backward(self): |
| 136 | # NOTE: we don't have the whole model here for speed |
| 137 | layers = [ |
| 138 | nn.Conv2d(1, 8, 5), Tensor.relu, |
| 139 | nn.Conv2d(8, 8, 5), Tensor.relu] |
| 140 | |
| 141 | # replace random weights with ones |
| 142 | Tensor.realize(*[p.replace(Tensor.ones_like(p).contiguous()) for p in nn.state.get_parameters(layers)]) |
| 143 | |
| 144 | # realize gradients |
| 145 | Tensor.empty(4, 1, 14, 14).sequential(layers).sum().backward() |
| 146 | Tensor.realize(*[x.grad for x in nn.state.get_parameters(layers) if x.grad is not None]) |
| 147 | |
| 148 | # *** image *** |
| 149 |
no test coverage detected