Don't throw away non-tensor objects in TensorDataclass (#2783)

* Don't throw away non-tensor objects in TensorDataclass

* Update test_tensor_dataclass.py

---------

Co-authored-by: Justin Kerr <justin.g.kerr@gmail.com>
This commit is contained in:
Brent YiandJustin Kerr authored and GitHub committed 2024-01-19 01:18:19 -08:00
1 parent f55bd04ca6
commit 99073eb187
2 files changed
+8

No files matched your search

+2
View File
@@ -141,6 +141,8 @@ class TensorDataclass:
new_dict[k] = v.broadcast_to(batch_shape)
elif isinstance(v, Dict):
new_dict[k] = self._broadcast_dict_fields(v, batch_shape)
else:
new_dict[k] = v
return new_dict
def __getitem__(self: TensorDataclassT, indices) -> TensorDataclassT: