[PT FE]: fix object has no attribute 'dtype' (#20755)
* [PT FE]: fix object has no attribute 'dtype' * add model in tests * update test
This commit is contained in:
1 parent
7eb53586f5
commit
c21fd2ea61
3 files changed
+9
-1
No files matched your search
@@ -67,7 +67,7 @@ class TorchScriptPythonDecoder (Decoder):
|
||||
preserved_attributes = []
|
||||
for name, module in model.named_modules():
|
||||
if hasattr(module, "weight"):
|
||||
if module.weight is not None and module.weight.dtype in [torch.int8, torch.uint8]:
|
||||
if module.weight is not None and getattr(module.weight, "dtype", None) in [torch.int8, torch.uint8]:
|
||||
preserved_attributes.append(name)
|
||||
return preserved_attributes
|
||||
|
||||
|
||||
Reference in new issue
Block a user