| 267 | mx.random.seed(0xF0F0F0F0) |
| 268 | |
| 269 | class MyConv(nn.Module): |
| 270 | def __init__(self, *args, **kwargs): |
| 271 | super().__init__() |
| 272 | self.aggregate = kwargs.pop("aggregate", False) |
| 273 | self.conv = nn.Conv2d(*args, **kwargs) |
| 274 | |
| 275 | def __call__(self, x): |
| 276 | x = self.conv(x) |
| 277 | if self.aggregate: |
| 278 | x = mx.distributed.all_sum(x) |
| 279 | return x |
| 280 | |
| 281 | def sharding(path, weight): |
| 282 | parts = path.split(".") |
no outgoing calls