[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:
Ekaterina Aidova authored and GitHub committed 2023-10-30 18:36:08 +00:00
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