diff --git a/test/test_tensordict.py b/test/test_tensordict.py index 3edf7a5b0..cd60c9bc2 100644 --- a/test/test_tensordict.py +++ b/test/test_tensordict.py @@ -2589,6 +2589,11 @@ def test_add_default(self): assert "d" not in tdadd assert "b" in tdadd + td0 = TensorDict(a=1, b=1, c=1, non_tensor="a string") + td1 = TensorDict(b=2, c=2, d=2, non_tensor="a string") + td = td0.add(td1, default=torch.zeros(())) + assert td["non_tensor"] == "a string" + def test_sub_default(self): # Create two tds with different key sets td0 = TensorDict(a=1, b=1, c=1)