diff --git a/paddle/operators/cross_entropy_op.cc b/paddle/operators/cross_entropy_op.cc index fe669b03ca498e253bd6c21a4d312f885dee5588..7d7bb09f3d63bef49913c3c7501082c509c45653 100644 --- a/paddle/operators/cross_entropy_op.cc +++ b/paddle/operators/cross_entropy_op.cc @@ -35,7 +35,7 @@ protected: PADDLE_ENFORCE(inputs[0]->dims().size() == 2, "X's dimension must be 2."); PADDLE_ENFORCE(outputs[0]->dims().size() == 1, "label's dimension must be 1."); - outputs[0]->set_dims(framework::make_ddim({inputs[0]->dims()[0]})); + outputs[0]->Resize(framework::make_ddim({inputs[0]->dims()[0]})); } }; diff --git a/paddle/operators/sgd_op.cc b/paddle/operators/sgd_op.cc index 04df87a3add2af7daa127a072f7b690f6cf94327..66ab1e001142bfb005d3c2e2ea29e01a32dce507 100644 --- a/paddle/operators/sgd_op.cc +++ b/paddle/operators/sgd_op.cc @@ -31,7 +31,7 @@ protected: PADDLE_ENFORCE(outputs[0] != nullptr, "outputs[0] mast be set"); PADDLE_ENFORCE(inputs[0]->dims() == inputs[1]->dims(), "Two input of SGD Op's dimension must be same."); - outputs[0]->set_dims(inputs[0]->dims()); + outputs[0]->Resize(inputs[0]->dims()); } };