From 90a63c0c0e1009cf05ecbd6f506f52bb0db3d627 Mon Sep 17 00:00:00 2001 From: City <125218114+city96@users.noreply.github.com> Date: Sat, 24 Aug 2024 08:17:06 +0200 Subject: [PATCH] Fix for Intel Arc Deep dive & fix by @simonlui in #50 --- ops.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ops.py b/ops.py index 6bc1e2a..0c5dba3 100644 --- a/ops.py +++ b/ops.py @@ -39,6 +39,14 @@ class GGMLTensor(torch.Tensor): except Exception as e: print(f"ignoring 'copy_' on tensor") + def __deepcopy__(self, *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 + @property def shape(self): if not hasattr(self, "tensor_shape"):