Skip to content

Commit

Permalink
[BugFix] Better handling of struct arrays
Browse files Browse the repository at this point in the history
ghstack-source-id: 37aecd40226db2362515fd00826bb336607e8749
Pull Request resolved: #1193
  • Loading branch information
vmoens committed Jan 27, 2025
1 parent f6426cd commit 9b66338
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tensordict/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11580,7 +11580,11 @@ def from_any(
device=device,
batch_size=batch_size,
)
if isinstance(obj, np.ndarray) and hasattr(obj.dtype, "names"):
if (
isinstance(obj, np.ndarray)
and hasattr(obj.dtype, "names")
and obj.dtype.names is not None
):
return cls.from_struct_array(
obj,
auto_batch_size=auto_batch_size,
Expand Down

0 comments on commit 9b66338

Please sign in to comment.