diff --git a/paddle/fluid/imperative/layer.cc b/paddle/fluid/imperative/layer.cc index ef6d8f4016a057fd9256499067f72dd9d11c452f..fcddcc4ed49b920fa0cc1d3d77920b5d8401dde6 100644 --- a/paddle/fluid/imperative/layer.cc +++ b/paddle/fluid/imperative/layer.cc @@ -153,9 +153,6 @@ void VarBase::ApplyGrad(framework::Scope* scope, Variable* grad) { std::vector OpBase::ApplyGrad(framework::Scope* scope) { VLOG(3) << "op grad " << grad_op_desc_->Type(); - if (!grad_to_var_) { - return {}; - } for (const std::string& grad_invar : grad_op_desc_->InputArgumentNames()) { if (grad_to_var_->find(grad_invar) == grad_to_var_->end()) {