Loading

RuntimeError: (NotFound) No Output(X@GRAD) found for BatchNormGrad operator. [Hint: Expected ctx->HasOutput(framework::GradVarName("X")) == true, but received ctx->HasOutput(framework::GradVarName

paddle 报错
RuntimeError: (NotFound) No Output(X@GRAD) found for BatchNormGrad operator.
[Hint: Expected ctx->HasOutput(framework::GradVarName("X")) == true, but received ctx->HasOutput(framework::GradVarName("X")):0 != true:1.] (at /paddle/paddle/fluid/operators/batch_norm_op.cc:468)

BN层的问题
修改方法:在BN层前加

if self.data_bn:
    x.stop_gradient = False
x = self.data_bn(x)
posted @ 2021-09-30 01:39  Guang'Jun  阅读(492)  评论(0)    收藏  举报