From 851564739d166b888dd9cea80f90dc8219393b52 Mon Sep 17 00:00:00 2001 From: City <125218114+city96@users.noreply.github.com> Date: Thu, 5 Dec 2024 03:16:23 +0100 Subject: [PATCH] Updated Intel Arc fix Provided by @simonlui in #50 as a patch --- ops.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ops.py b/ops.py index cea313e..db421cf 100644 --- a/ops.py +++ b/ops.py @@ -39,13 +39,15 @@ class GGMLTensor(torch.Tensor): except Exception as e: print(f"ignoring 'copy_' on tensor: {e}") - def __deepcopy__(self, *args, **kwargs): + def new_empty(self, size, *args, **kwargs): # Intel Arc fix, ref#50 - new = super().__deepcopy__(*args, **kwargs) - new.tensor_type = getattr(self, "tensor_type", None) - new.tensor_shape = getattr(self, "tensor_shape", new.data.shape) - new.patches = getattr(self, "patches", []).copy() - return new + new_tensor = super().new_empty(size, *args, **kwargs) + return GGMLTensor( + new_tensor, + tensor_type = getattr(self, "tensor_type", None), + tensor_shape = size, + patches = getattr(self, "patches", []).copy() + ) @property def shape(self):