diff --git a/paddle/fluid/operators/expand_as_v2_op.cc b/paddle/fluid/operators/expand_as_v2_op.cc index 495b640bb4399736456bf391c6522686b9763951..e8008056c484703e03aa03fc7f4bf34a899f6b43 100644 --- a/paddle/fluid/operators/expand_as_v2_op.cc +++ b/paddle/fluid/operators/expand_as_v2_op.cc @@ -45,7 +45,7 @@ class ExpandAsV2Op : public framework::OperatorWithKernel { "The rank of Input(target_tensor) must not be less than or equal " "to %d. But received: input rank %u, input shape [%s].", MAX_RANK_SUPPORTED, x_dims.size(), x_dims)); - std::vector out_shape(target_tensor_dims.size()); + std::vector out_shape = framework::vectorize(target_tensor_dims); ctx->SetOutputDim("Out", framework::make_ddim(out_shape)); } };