8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5001d3 commit 3eb04aeCopy full SHA for 3eb04ae
test/test_autograd.py
@@ -9333,12 +9333,11 @@ def forward(self, x):
9333
tmp.grad_fn.metadata["a"] = test
9334
9335
with set_warn_always_context(True):
9336
- with warnings.catch_warnings(record=True) as w:
+ with warnings.catch_warnings(record=True) as ws:
9337
tmp.exp().sum().backward(create_graph=True)
9338
- self.assertTrue(len(w) == 1)
9339
- self.assertTrue(
9340
- "Using backward() with create_graph=True" in str(w[0].message)
9341
- )
+ filtered_ws = [
+ w for w in ws if "Using backward() with create_graph=True" in str(w.message)]
+ self.assertTrue(len(filtered_ws) == 1)
9342
9343
# Remove the backward + create_graph=True cycle
9344
a.grad = None
0 commit comments