@@ -28,6 +28,8 @@ using ScopedTensorDescriptor = platform::ScopedTensorDescriptor;
28
28
using ScopedFilterDescriptor = platform::ScopedFilterDescriptor;
29
29
using ScopedConvolutionDescriptor = platform::ScopedConvolutionDescriptor;
30
30
using DataLayout = platform::DataLayout;
31
+ template <typename T>
32
+ using ScalingParamType = typename platform::CudnnDataType<T>::ScalingParamType;
31
33
32
34
static constexpr size_t kCONV_CUDNN_WORKSPACE_LIMIT_BYTES =
33
35
static_cast <size_t >(1024 ) * 1024 * 1024 ;
@@ -134,8 +136,7 @@ class CUDNNConvOpKernel : public framework::OpKernel<T> {
134
136
platform::CUDAPlace gpu = boost::get<platform::CUDAPlace>(ctx.GetPlace ());
135
137
cudnn_workspace = paddle::memory::Alloc (gpu, workspace_size_in_bytes);
136
138
// ------------------- cudnn conv forward ---------------------
137
- typename platform::CudnnDataType<T>::ScalingParamType alpha = 1 .0f ,
138
- beta = 0 .0f ;
139
+ ScalingParamType<T> alpha = 1 .0f , beta = 0 .0f ;
139
140
for (int i = 0 ; i < groups; i++) {
140
141
PADDLE_ENFORCE (platform::dynload::cudnnConvolutionForward (
141
142
handle, &alpha, cudnn_input_desc, input_data + i * group_offset_in,
@@ -282,8 +283,7 @@ class CUDNNConvGradOpKernel : public framework::OpKernel<T> {
282
283
platform::CUDAPlace gpu = boost::get<platform::CUDAPlace>(ctx.GetPlace ());
283
284
cudnn_workspace = paddle::memory::Alloc (gpu, workspace_size_in_bytes);
284
285
// ------------------- cudnn conv backward data ---------------------
285
- typename platform::CudnnDataType<T>::ScalingParamType alpha = 1 .0f ,
286
- beta = 0 .0f ;
286
+ ScalingParamType<T> alpha = 1 .0f , beta = 0 .0f ;
287
287
if (input_grad) {
288
288
T* input_grad_data = input_grad->mutable_data <T>(ctx.GetPlace ());
289
289
// Because beta is zero, it is unnecessary to reset input_grad.
0 commit comments