diff --git a/backend/src/nodes/impl/pytorch/auto_split.py b/backend/src/nodes/impl/pytorch/auto_split.py index 3b8e24b7b..12ea8d40e 100644 --- a/backend/src/nodes/impl/pytorch/auto_split.py +++ b/backend/src/nodes/impl/pytorch/auto_split.py @@ -58,7 +58,11 @@ def _into_tensor( img = np.copy(img) else: # since we are going to copy the image to the GPU, we can skip the copy here - img.flags.writeable = True + try: + img.flags.writeable = True + except Exception: + # Some arrays cannot be made writeable, and we need to copy them + img = np.copy(img) input_tensor = torch.from_numpy(img).to(device, dtype) return input_tensor finally: