mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
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:
committed by
Soumith Chintala
parent
67c3cbd5e2
commit
0a434ff685
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user