Skip to content

Commit

Permalink
[Versioning] python 3.8 compatibility fix
Browse files Browse the repository at this point in the history
ghstack-source-id: b59931a5b6d3062593228cb16fb026438c3c6105
Pull Request resolved: #1127
  • Loading branch information
vmoens committed Dec 4, 2024
1 parent 68ce9c3 commit be4915f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tensordict/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from collections.abc import KeysView
from contextlib import nullcontext
from copy import copy
from dataclasses import _FIELDS, GenericAlias
from functools import wraps
from importlib import import_module
from numbers import Number
Expand Down Expand Up @@ -75,6 +74,18 @@
if TYPE_CHECKING:
from tensordict.tensordict import TensorDictBase

try:
from dataclasses import _FIELDS, GenericAlias
except ImportError:
# python < 3.9
from dataclasses import _FIELDS

class GenericAlias:
"""Placeholder."""

...


try:
try:
from torch._C._functorch import ( # @manual=fbcode//caffe2:torch
Expand Down

0 comments on commit be4915f

Please sign in to comment.