mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-23 16:15:36 +08:00
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:
1 parent
f55bd04ca6
commit
99073eb187
2 files changed
+8
No files matched your search
@@ -179,6 +179,12 @@ def test_iter():
|
||||
assert batch.b.shape == (4, 5)
|
||||
|
||||
|
||||
def test_non_tensor():
|
||||
"""Test iterating over tensor dataclass"""
|
||||
# We shouldn't throw away non-dataclass values.
|
||||
assert DummyTensorDataclass(a=torch.ones((3, 10)), b={"k": 2}, c=None).b == {"k": 2} # type: ignore
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_init()
|
||||
test_broadcasting()
|
||||
|
||||
Reference in new issue
Block a user