Remove Function::is_executable (#3907)

* Remove Function::is_executable

Ensure that grad_fn is null if requires_grad is false.

* Assert that grad_fn implies requires_grad=True
This commit is contained in:
Sam Gross
2017-11-28 21:29:27 -05:00
committed by Soumith Chintala
parent 67c3cbd5e2
commit 0a434ff685
20 changed files with 50 additions and 98 deletions

View File

@ -390,9 +390,6 @@ int THPVariable_set_requires_grad(THPVariable *self, PyObject *obj)
return -1;
}
var.requires_grad() = (obj == Py_True);
if (auto grad_accumulator = var.get()->grad_accumulator.lock()) {
grad_accumulator->is_executable = var.requires_grad();
}
return 0;
END_HANDLE_TH_ERRORS_RET(-1)
}