Record shape and type in autograd to validate gradients (#8168)

The check that the gradient is defined is currently disabled because
TestJit.test_ge_optimized will trigger the error.
This commit is contained in:
Sam Gross
2018-06-06 18:09:53 -04:00
committed by GitHub
parent 36b8cc5483
commit 12229afd00
23 changed files with 208 additions and 66 deletions

View File

@@ -71,7 +71,7 @@ TEST_CASE("autograd") {
}
SECTION("custom gradient inputs") {
z.sum().backward(
autograd::make_variable(at::ones(at::CPU(at::kFloat), {1}) * 2));
autograd::make_variable(at::ones(at::CPU(at::kFloat), {}) * 2));
REQUIRE(x.grad().allclose(y * 2));
}
// Assume everything else is safe from PyTorch tests.