diff options
author | brkirch <brkirch@users.noreply.github.com> | 2022-10-25 02:01:57 -0400 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-25 09:42:53 +0300 |
commit | faed465a0b1a7d19669568738c93e04907c10415 (patch) | |
tree | 912274ef626bababc846ee9849bc4b390e968c44 /modules/swinir_model.py | |
parent | 4c24347e45776d505937856ab280548d9298f0a8 (diff) |
MPS Upscalers Fix
Get ESRGAN, SCUNet, and SwinIR working correctly on MPS by ensuring memory is contiguous for tensor views before sending to MPS device.
Diffstat (limited to 'modules/swinir_model.py')
-rw-r--r-- | modules/swinir_model.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/swinir_model.py b/modules/swinir_model.py index facd262d..4253b66d 100644 --- a/modules/swinir_model.py +++ b/modules/swinir_model.py @@ -111,7 +111,7 @@ def upscale( img = img[:, :, ::-1] img = np.moveaxis(img, 2, 0) / 255 img = torch.from_numpy(img).float() - img = img.unsqueeze(0).to(devices.device_swinir) + img = devices.mps_contiguous_to(img.unsqueeze(0), devices.device_swinir) with torch.no_grad(), precision_scope("cuda"): _, _, h_old, w_old = img.size() h_pad = (h_old // window_size + 1) * window_size - h_old |