mlx icon indicating copy to clipboard operation
mlx copied to clipboard

Upsample support

Open Dam930 opened this issue 1 year ago • 2 comments

I would like to request the addition of native support for the Upsample operation in MLX. Currently, the absence of Upsample functionality limits the flexibility of certain tasks that require resizing or upsampling of data (like UNet definition).

In the meanwhile, does someone have alternative methods for emulating the upsample functionality?

Thank you!

Dam930 avatar Dec 08 '23 12:12 Dam930

See the upsample_nearest function the Stable Diffusion example:

def upsample_nearest(x, scale: int = 2):
    B, H, W, C = x.shape
    x = mx.broadcast_to(x[:, :, None, :, None, :], (B, H, scale, W, scale, C))
    x = x.reshape(B, H * scale, W * scale, C)

    return x

StanislavNikolov avatar Dec 08 '23 12:12 StanislavNikolov

Thank you very much! If you do not plan to implement a standalone class, it is possible for me to close the issue.

Dam930 avatar Dec 08 '23 14:12 Dam930