(x, scale: int = 2)
| 10 | |
| 11 | |
| 12 | def upsample_nearest(x, scale: int = 2): |
| 13 | B, H, W, C = x.shape |
| 14 | x = mx.broadcast_to(x[:, :, None, :, None, :], (B, H, scale, W, scale, C)) |
| 15 | x = x.reshape(B, H * scale, W * scale, C) |
| 16 | |
| 17 | return x |
| 18 | |
| 19 | |
| 20 | class TimestepEmbedding(nn.Module): |