Familiarize yourself with the following function. 'mx' is an array framework inspired by…
- User
Familiarize yourself with the following function. 'mx' is an array framework inspired by PyTorch but not as extensive. You can't assume it has a lot of specialised functions.
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)
codereturn xNow, implement the function
downsample_nearest(x, target_width, target_height) Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.