Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
vmoens committed Nov 23, 2024
2 parents bb97507 + 849270c commit 0202562
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tensordict/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9873,15 +9873,14 @@ def from_any(cls, obj, *, auto_batch_size: bool = False):
return cls.from_dict(obj, auto_batch_size=auto_batch_size)
if isinstance(obj, np.ndarray) and hasattr(obj.dtype, "names"):
return cls.from_struct_array(obj, auto_batch_size=auto_batch_size)

if isinstance(obj, tuple):
if is_namedtuple(obj):
return cls.from_namedtuple(obj, auto_batch_size=auto_batch_size)
return cls.from_tuple(obj, auto_batch_size=auto_batch_size)
if isinstance(obj, list):
return cls.from_tuple(tuple(obj), auto_batch_size=auto_batch_size)
if is_dataclass(obj):
return cls.from_dataclass(obj, auto_batch_size=auto_batch_size)
if is_namedtuple(obj):
return cls.from_namedtuple(obj, auto_batch_size=auto_batch_size)
if _has_h5:
import h5py

Expand Down

0 comments on commit 0202562

Please sign in to comment.