Revert #7750 and #7762 to fix Windows CI on master (#7772)

* Revert "Add missing brace (#7762)"

This reverts commit ea27c5af50.

* Revert "[C++ API] Add backward() to Tensor and Variable  (#7750)"

This reverts commit 1e2762796f.
This commit is contained in:
Will Feng
2018-05-22 15:42:52 -07:00
committed by Peter Goldsborough
parent 8d91a602cc
commit 60745b3380
19 changed files with 71 additions and 126 deletions
+1 -23
View File
@@ -16,7 +16,7 @@ TEST_CASE("misc") {
auto y = model->forward({x})[0];
Variable s = y.sum();
s.backward();
backward(s);
REQUIRE(!model->parameters()["weight"].grad().defined());
}
@@ -45,28 +45,6 @@ TEST_CASE("misc_cuda", "[cuda]") {
}
}
TEST_CASE("autograd") {
auto x = autograd::make_variable(
at::randn(at::CPU(at::kFloat), {3, 3}), /*requires_grad=*/true);
auto y = autograd::make_variable(
at::randn(at::CPU(at::kFloat), {3, 3}), /*requires_grad=*/false);
auto z = x * y;
SECTION("derivatives of zero-dim tensors") {
z.sum().backward();
REQUIRE(x.grad().allclose(y));
}
SECTION("derivatives of tensors") {
z.backward();
REQUIRE(x.grad().allclose(y));
}
SECTION("custom gradient inputs") {
z.sum().backward(
autograd::make_variable(at::ones(at::CPU(at::kFloat), {1}) * 2));
REQUIRE(x.grad().allclose(y * 2));
}
// Assume everything else is safe from PyTorch tests.
}
TEST_CASE("expanding-array") {
SECTION("successful construction") {
SECTION("initializer_list") {