From 496aadfb52e15bdd6dbdbae6c52d1ed1023ac7f2 Mon Sep 17 00:00:00 2001 From: ShiningZhang Date: Mon, 21 Feb 2022 10:31:22 +0800 Subject: [PATCH] fix bug: core when missing range XPU kernel in kunlun2 (#39673) --- paddle/fluid/operators/range_op.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paddle/fluid/operators/range_op.cc b/paddle/fluid/operators/range_op.cc index 8585ecd2f94..3c2fe8b9e5d 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; } }; -- GitLab