Skip to content

Commit bf99396

Browse files
committed
fix errors in sequence_slice_op
1 parent baa9f50 commit bf99396

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

paddle/fluid/operators/sequence_slice_op.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,11 @@ class SequenceSliceOpKernel : public framework::OpKernel<T> {
6666

6767
if (platform::is_gpu_place(ctx.GetPlace())) {
6868
offset_cpu.mutable_data<T>(offset->dims(), platform::CPUPlace());
69-
framework::TensorCopy(*offset, platform::CPUPlace(), ctx.device_context(),
70-
&offset_cpu);
69+
framework::TensorCopySync(*offset, platform::CPUPlace(), &offset_cpu);
7170
offset_data = offset_cpu.data<int64_t>();
7271

7372
length_cpu.mutable_data<T>(length->dims(), platform::CPUPlace());
74-
framework::TensorCopy(*length, platform::CPUPlace(), ctx.device_context(),
75-
&length_cpu);
73+
framework::TensorCopySync(*length, platform::CPUPlace(), &length_cpu);
7674
length_data = length_cpu.data<int64_t>();
7775
}
7876

@@ -127,13 +125,11 @@ class SequenceSliceGradOpKernel : public framework::OpKernel<T> {
127125

128126
if (platform::is_gpu_place(ctx.GetPlace())) {
129127
offset_cpu.mutable_data<T>(offset->dims(), platform::CPUPlace());
130-
framework::TensorCopy(*offset, platform::CPUPlace(), ctx.device_context(),
131-
&offset_cpu);
128+
framework::TensorCopySync(*offset, platform::CPUPlace(), &offset_cpu);
132129
offset_data = offset_cpu.data<int64_t>();
133130

134131
length_cpu.mutable_data<T>(length->dims(), platform::CPUPlace());
135-
framework::TensorCopy(*length, platform::CPUPlace(), ctx.device_context(),
136-
&length_cpu);
132+
framework::TensorCopySync(*length, platform::CPUPlace(), &length_cpu);
137133
length_data = length_cpu.data<int64_t>();
138134
}
139135

0 commit comments

Comments
 (0)