Fix auto exponent issue for torch.pow (#47024)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47024

Fixes https://github.com/pytorch/pytorch/issues/46936

Stack from [ghstack](https://github.com/ezyang/ghstack):
* **#47024 Fix auto exponent issue for torch.pow**

Test Plan: Imported from OSS

Reviewed By: malfet

Differential Revision: D24698027

Pulled By: anjali411

fbshipit-source-id: f23fdb65c925166243593036e08214c4f041a63d
This commit is contained in:
anjali411
2020-11-14 22:43:59 -08:00
committed by Facebook GitHub Bot
parent d293413b3e
commit 8ef7ccd669
5 changed files with 36 additions and 15 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ TEST(AutogradAPITests, AnomalyMode) {
auto y = x.pow(1.5);
auto gr =
grad({y}, {x}, {}, /*retain_graph=*/true, /*create_backward=*/true);
ASSERT_THROWS_WITH(grad({gr[0]}, {x});, "returned nan");
ASSERT_THROWS_WITH(grad({gr[0]}, {x}, {torch::tensor({0.0})});, "returned nan");
auto msgs = warnings.messages();
ASSERT_EQ(msgs.size(), 2);
ASSERT_TRUE(