RuntimeError: (NotFound) No Output([email protected]) found for BatchNormGrad operator. [Hint: Expected ctx->HasOutput(framework::GradVarName(“X”)) == true, but received ctx->HasOutput(framework::GradVarName

paddle error
RuntimeError: (NotFound) No Output([email protected]) 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)

The problem of BN layer
Modification method: Precede the BN layer with

if self.data_bn:
    x.stop_gradient = False
x = self.data_bn(x)

Similar Posts: