Skip to content

Commit

Permalink
Updated Intel Arc fix
Browse files Browse the repository at this point in the history
Provided by @simonlui in #50 as a patch
  • Loading branch information
city96 committed Dec 5, 2024
1 parent 39102df commit 8515647
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def copy_(self, *args, **kwargs):
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):
Expand Down

0 comments on commit 8515647

Please sign in to comment.