Download mnist_classifier/classifier.py from mmacosha/slice-sampling-checkpoints: direct link, hf CLI and curl.
- Browser
- Download file 586 Bytes
-
https://huggingface.co/mmacosha/slice-sampling-checkpoints/resolve/main/mnist_classifier/classifier.py
- Command line
-
hf download hf://mmacosha/slice-sampling-checkpoints/mnist_classifier/classifier.py
-
curl -L -o classifier.py https://huggingface.co/mmacosha/slice-sampling-checkpoints/resolve/main/mnist_classifier/classifier.py
586 Bytes
| import jax | |
| from flax import linen as nn | |
| Array = jax.Array | |
| class Classifier(nn.Module): | |
| num_classes: int | |
| base_channels: int = 16 | |
| def __call__(self, x: Array) -> Array: | |
| h = nn.Conv(self.base_channels, kernel_size=(3, 3))(x) | |
| h = nn.relu(h) | |
| h = nn.max_pool(h, window_shape=(2, 2), strides=(2, 2)) | |
| h = nn.Conv(self.base_channels * 2, kernel_size=(3, 3))(h) | |
| h = nn.relu(h) | |
| h = nn.max_pool(h, window_shape=(2, 2), strides=(2, 2)) | |
| h = h.reshape(h.shape[0], -1) | |
| return nn.Dense(self.num_classes)(h) | |