@@ -66,13 +66,11 @@ class SequenceSliceOpKernel : public framework::OpKernel<T> {
66
66
67
67
if (platform::is_gpu_place (ctx.GetPlace ())) {
68
68
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);
71
70
offset_data = offset_cpu.data <int64_t >();
72
71
73
72
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);
76
74
length_data = length_cpu.data <int64_t >();
77
75
}
78
76
@@ -127,13 +125,11 @@ class SequenceSliceGradOpKernel : public framework::OpKernel<T> {
127
125
128
126
if (platform::is_gpu_place (ctx.GetPlace ())) {
129
127
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);
132
129
offset_data = offset_cpu.data <int64_t >();
133
130
134
131
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);
137
133
length_data = length_cpu.data <int64_t >();
138
134
}
139
135
0 commit comments