Skip to content

Commit a7bd0c0

Browse files
committed
Add test_empty_tensor_dict
1 parent ed171e6 commit a7bd0c0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/unit/autojac/_transform/test_tensor_dict.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,10 @@ def test_immutability():
120120
t[torch.ones(1)] = torch.ones(1)
121121

122122
assert t == Gradients({})
123+
124+
125+
def test_empty_tensor_dict():
126+
"""Tests that it's impossible to instantiate a non-empty EmptyTensorDict."""
127+
128+
with raises(ValueError):
129+
_ = EmptyTensorDict({torch.ones(1): torch.ones(1)})

0 commit comments

Comments
 (0)