Skip to content

Commit

Permalink
[Test] Test non-tensor propagation in arithmetic ops (#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmoens authored Jul 30, 2024
1 parent 378c53f commit 484a045
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_tensordict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit 484a045

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'CPU Benchmark Results'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 484a045 Previous: 378c53f Ratio
benchmarks/common/common_ops_test.py::test_membership_stacked_nested_last 78168.68718753356 iter/sec (stddev: 8.398408736772949e-7) 195232.10821523724 iter/sec (stddev: 3.8445949578598973e-7) 2.50
benchmarks/common/common_ops_test.py::test_membership_stacked_nested_leaf_last 77953.60553273192 iter/sec (stddev: 6.636602780806456e-7) 196190.70869223986 iter/sec (stddev: 5.401214436549456e-7) 2.52

This comment was automatically generated by workflow using github-action-benchmark.

CC: @vmoens

Please sign in to comment.