mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-15 00:58:02 -05:00
raise exected exception when attempting to change dtype
This commit is contained in:
committed by
psychedelicious
parent
93d4b00082
commit
a07fac6180
@@ -123,6 +123,12 @@ class GGMLTensor(torch.Tensor):
|
||||
def to(self, *args, **kwargs) -> torch.Tensor: ...
|
||||
|
||||
def to(self, *args, **kwargs):
|
||||
for func_arg in args:
|
||||
if isinstance(func_arg, torch.dtype) and func_arg != self.quantized_data.dtype:
|
||||
raise ValueError("Operation changed the dtype of GGMLTensor unexpectedly.")
|
||||
if 'dtype' in kwargs.keys():
|
||||
if kwargs['dtype'] != self.quantized_data.dtype:
|
||||
raise ValueError("Operation changed the dtype of GGMLTensor unexpectedly."
|
||||
self.quantized_data = self.quantized_data.to(*args, **kwargs)
|
||||
return self
|
||||
|
||||
|
||||
Reference in New Issue
Block a user