Commit 706470a
committed
Update on "modify the conditions as PythonModuleVariable"
## Motivation
The current code of `value in [torch.backends.cudnn, torch.ops]` requires `value` to have the implementation of `__eq__`. If the value is a custom object and does not implement `__eq__`, dynamo will throw error. For example, ConvolutionOpContext, the custom 'torch._C.ScriptClass' object registered in IPEX, dynamo will throw the following error:
**torch._dynamo.exc.InternalTorchDynamoError: '__eq__' is not implemented for __torch__.torch.classes.ipex_prepack.ConvolutionOpContext**
I think this is a common issue, To avoid this issue, the PR replaces the current code `value in [torch.backends.cudnn, torch.ops]`with `isinstance(value, (torch.backends.cudnn.CudnnModule, torch._ops._Ops)`
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv chenyang78 aakhundov kadeng
[ghstack-poisoned]1 file changed
+3
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
3290 | 3289 | | |
3291 | 3290 | | |
3292 | 3291 | | |
3293 | | - | |
3294 | | - | |
| 3292 | + | |
3295 | 3293 | | |
3296 | 3294 | | |
3297 | 3295 | | |
| |||
3317 | 3315 | | |
3318 | 3316 | | |
3319 | 3317 | | |
3320 | | - | |
3321 | | - | |
3322 | | - | |
3323 | | - | |
3324 | | - | |
| 3318 | + | |
3325 | 3319 | | |
3326 | 3320 | | |
3327 | 3321 | | |
| |||
0 commit comments