mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix mypy errors: PyTreeSpec inheritance (#160652)
Fixes #160650. I added type ignore comment to `LeafSpec` class inheritance in `torch/utils/_cxx_pytree.py` to handle `PyTreeSpec` being marked as final in optree's type stubs. Pull Request resolved: https://github.com/pytorch/pytorch/pull/160652 Approved by: https://github.com/Skylion007
This commit is contained in:
parent
11b6ceb7b4
commit
114813ca77
|
|
@ -994,7 +994,7 @@ class LeafSpecMeta(type(TreeSpec)): # type: ignore[misc]
|
|||
return _is_pytreespec_instance(instance) and instance.is_leaf()
|
||||
|
||||
|
||||
class LeafSpec(TreeSpec, metaclass=LeafSpecMeta):
|
||||
class LeafSpec(TreeSpec, metaclass=LeafSpecMeta): # type: ignore[misc,final]
|
||||
def __new__(cls) -> "LeafSpec":
|
||||
return optree.treespec_leaf(none_is_leaf=True) # type: ignore[return-value]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user