diff --git a/paddle/fluid/operators/pad2d_op.cc b/paddle/fluid/operators/pad2d_op.cc index 9495e7075829308f128e2514de25cb2e65b48835..3ae006a60c8c3ccc3d5911793a04993127582b28 100644 --- a/paddle/fluid/operators/pad2d_op.cc +++ b/paddle/fluid/operators/pad2d_op.cc @@ -345,7 +345,7 @@ class Pad2dCPUKernel : public framework::OpKernel { GetPaddings(pads, context); auto mode = context.Attr("mode"); auto data_format = context.Attr("data_format"); - T value = context.Attr("pad_value"); + T value = static_cast(context.Attr("pad_value")); auto* x = context.Input("X"); auto in_dims = x->dims(); diff --git a/paddle/fluid/operators/pad2d_op.cu b/paddle/fluid/operators/pad2d_op.cu index f88b195b646f18e3677ddcf78c2ceab1335a44f8..c05d778fb29c88c69ba389fdb1a9b024cf237af2 100644 --- a/paddle/fluid/operators/pad2d_op.cu +++ b/paddle/fluid/operators/pad2d_op.cu @@ -314,7 +314,7 @@ class Pad2dCUDAKernel : public framework::OpKernel { GetPaddings(pads, context); auto mode = context.Attr("mode"); auto data_format = context.Attr("data_format"); - T value = context.Attr("pad_value"); + T value = static_cast(context.Attr("pad_value")); auto* x = context.Input("X"); auto in_dims = x->dims();