(self, has_batchnorm=False)
| 26 | # create a model with a conv layer |
| 27 | class TinyConvNet: |
| 28 | def __init__(self, has_batchnorm=False): |
| 29 | # https://keras.io/examples/vision/mnist_convnet/ |
| 30 | conv = 3 |
| 31 | #inter_chan, out_chan = 32, 64 |
| 32 | inter_chan, out_chan = 8, 16 # for speed |
| 33 | self.c1 = Tensor.scaled_uniform(inter_chan,1,conv,conv) |
| 34 | self.c2 = Tensor.scaled_uniform(out_chan,inter_chan,conv,conv) |
| 35 | self.l1 = Tensor.scaled_uniform(out_chan*5*5, 10) |
| 36 | if has_batchnorm: |
| 37 | self.bn1 = BatchNorm2d(inter_chan) |
| 38 | self.bn2 = BatchNorm2d(out_chan) |
| 39 | else: |
| 40 | self.bn1, self.bn2 = lambda x: x, lambda x: x |
| 41 | |
| 42 | def parameters(self): |
| 43 | return get_parameters(self) |
nothing calls this directly
no test coverage detected