From 23cd19fbc7fd8df48e5955c1b3f38e67ca32a5db Mon Sep 17 00:00:00 2001 From: Jason Fried Date: Mon, 8 May 2023 13:53:16 -0700 Subject: [PATCH] typing.NamedTuple.field_types removed in favor of __annotations__ Summary: typing.NamedTuple was simplified in 3.10 These two fields were the same in 3.8, so this should be a no-op #buildmore Reviewed By: bottler Differential Revision: D45373526 fbshipit-source-id: 2b26156f5f65b7be335133e9e705730f7254260d --- pytorch3d/implicitron/dataset/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch3d/implicitron/dataset/types.py b/pytorch3d/implicitron/dataset/types.py index 421cbc34..58eac677 100644 --- a/pytorch3d/implicitron/dataset/types.py +++ b/pytorch3d/implicitron/dataset/types.py @@ -204,7 +204,7 @@ def _dataclass_list_from_dict_list(dlist, typeannot): # otherwise, we dispatch by the type of the provided annotation to convert to if issubclass(cls, tuple) and hasattr(cls, "_fields"): # namedtuple # For namedtuple, call the function recursively on the lists of corresponding keys - types = cls._field_types.values() + types = cls.__annotations__.values() dlist_T = zip(*dlist) res_T = [ _dataclass_list_from_dict_list(key_list, tp) @@ -270,7 +270,7 @@ def _dataclass_from_dict(d, typeannot): cls = get_origin(typeannot) or typeannot if issubclass(cls, tuple) and hasattr(cls, "_fields"): # namedtuple - types = cls._field_types.values() + types = cls.__annotations__.values() return cls(*[_dataclass_from_dict(v, tp) for v, tp in zip(d, types)]) elif issubclass(cls, (list, tuple)): types = get_args(typeannot)