diff --git a/paddle/fluid/operators/range_op.cc b/paddle/fluid/operators/range_op.cc index 8585ecd2f94cc86c4d130b47b14c7c7f68620237..3c2fe8b9e5d9f4022cb232fa09c7748f76c84b20 100644 --- a/paddle/fluid/operators/range_op.cc +++ b/paddle/fluid/operators/range_op.cc @@ -71,6 +71,10 @@ class RangeOp : public framework::OperatorWithKernel { framework::OpKernelType GetKernelTypeForVar( const std::string &var_name, const framework::Tensor &tensor, const framework::OpKernelType &expected_kernel_type) const override { + if (platform::is_xpu_place(tensor.place())) { + return framework::OpKernelType(expected_kernel_type.data_type_, + tensor.place(), tensor.layout()); + } return expected_kernel_type; } };