diff --git a/paddle/fluid/operators/lstsq_op.cu b/paddle/fluid/operators/lstsq_op.cu index 82a56af7eb4f14df91c7cc16a659370dfb251da9..f063716b2000846f2085abe47f402807e0cad950 100644 --- a/paddle/fluid/operators/lstsq_op.cu +++ b/paddle/fluid/operators/lstsq_op.cu @@ -157,7 +157,7 @@ class LstsqCUDAKernel : public framework::OpKernel { Tensor trans_q = dito.Transpose(new_x); Tensor slice_q = dito.Slice(trans_q, {-1}, {0}, {m}); Tensor solu_tensor = dito.Matmul(slice_q, *solution, false, false); - framework::TensorCopy(solu_tensor, solution->place(), solution); + framework::TensorCopy(solu_tensor, context.GetPlace(), solution); } } }; diff --git a/paddle/fluid/operators/lstsq_op.h b/paddle/fluid/operators/lstsq_op.h index b3e5894a9451e78b0de11d0589feefe3de3c1973..7e71d17364fc95b90a19ab08214455f7b5401ed8 100644 --- a/paddle/fluid/operators/lstsq_op.h +++ b/paddle/fluid/operators/lstsq_op.h @@ -112,8 +112,8 @@ class LstsqCPUKernel : public framework::OpKernel { Tensor input_x_trans = dito.Transpose(new_x); Tensor input_y_trans = dito.Transpose(*solution); - framework::TensorCopy(input_x_trans, new_x.place(), &new_x); - framework::TensorCopy(input_y_trans, solution->place(), solution); + framework::TensorCopy(input_x_trans, context.GetPlace(), &new_x); + framework::TensorCopy(input_y_trans, context.GetPlace(), solution); auto* x_vector = new_x.data(); auto* y_vector = solution->data(); @@ -310,7 +310,7 @@ class LstsqCPUKernel : public framework::OpKernel { } Tensor tmp_s = dito.Transpose(*solution); - framework::TensorCopy(tmp_s, solution->place(), solution); + framework::TensorCopy(tmp_s, context.GetPlace(), solution); if (m > n) { auto* solu_data = solution->data();