提交 94fa9d1a 编写于 作者: W wanghaoshuang

Remove const cast for device context

上级 a4b1abe5
...@@ -91,12 +91,11 @@ void CropCUDAFunctoin(const framework::ExecutionContext& context) { ...@@ -91,12 +91,11 @@ void CropCUDAFunctoin(const framework::ExecutionContext& context) {
int block = 512; int block = 512;
int grid = (n * d + block - 1) / block; int grid = (n * d + block - 1) / block;
auto* device_context = CropKernel<
const_cast<platform::DeviceContext*>(context.device_context_); T,
CropKernel<T, D><<<grid, block, 0, reinterpret_cast<const platform::CUDADeviceContext&>(
D><<<grid, block, 0, context.device_context())
reinterpret_cast<platform::CUDADeviceContext*>(device_context) .stream()>>>(
->stream()>>>(
out_count, out_shape_gpu.data<int64_t>(), x_shape_gpu.data<int64_t>(), out_count, out_shape_gpu.data<int64_t>(), x_shape_gpu.data<int64_t>(),
crop_rules_gpu.data<int>(), x_data, out_data); crop_rules_gpu.data<int>(), x_data, out_data);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册