MCPcopy Create free account
hub / github.com/ml-explore/mlx-examples / upsample_nearest

Function upsample_nearest

cvae/vae.py:10–14  ·  view source on GitHub ↗
(x, scale: int = 2)

Source from the content-addressed store, hash-verified

8
9# from https://github.com/ml-explore/mlx-examples/blob/main/stable_diffusion/stable_diffusion/unet.py
10def upsample_nearest(x, scale: int = 2):
11 B, H, W, C = x.shape
12 x = mx.broadcast_to(x[:, :, None, :, None, :], (B, H, scale, W, scale, C))
13 x = x.reshape(B, H * scale, W * scale, C)
14 return x
15
16
17class UpsamplingConv2d(nn.Module):

Callers 2

__call__Method · 0.70
__call__Method · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected