hl_cuda_cudnn_stub.h 9.9 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Z
zhangjinchao01 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

#ifndef HL_CUDA_CUDNN_STUB_H_
#define HL_CUDA_CUDNN_STUB_H_

#include "hl_cuda_cudnn.h"

20
inline int hl_get_cudnn_lib_version() { return 0; }
Z
zhangjinchao01 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

inline void hl_create_tensor_descriptor(hl_tensor_descriptor* image_desc) {}

inline void hl_tensor_reshape(hl_tensor_descriptor image_desc,
                              int batch_size,
                              int feature_maps,
                              int height,
                              int width) {}

inline void hl_tensor_reshape(hl_tensor_descriptor image_desc,
                              int batch_size,
                              int feature_maps,
                              int height,
                              int width,
                              int nStride,
                              int cStride,
                              int hStride,
                              int wStride) {}

inline void hl_destroy_tensor_descriptor(hl_tensor_descriptor image_desc) {}

inline void hl_create_pooling_descriptor(hl_pooling_descriptor* pooling_desc,
                                         hl_pooling_mode_t mode,
                                         int height,
                                         int width,
                                         int height_padding,
                                         int width_padding,
                                         int stride_height,
                                         int stride_width) {}

inline void hl_destroy_pooling_descriptor(hl_pooling_descriptor pooling_desc) {}

inline void hl_pooling_forward(hl_tensor_descriptor input,
                               real* input_image,
                               hl_tensor_descriptor output,
                               real* output_image,
                               hl_pooling_descriptor pooling) {}

inline void hl_pooling_backward(hl_tensor_descriptor input,
                                real* input_image,
                                real* input_image_grad,
                                hl_tensor_descriptor output,
                                real* output_image,
                                real* output_image_grad,
                                hl_pooling_descriptor pooling) {}

inline void hl_create_filter_descriptor(hl_filter_descriptor* filter,
68 69 70 71
                                        int input_feature_maps,
                                        int output_feature_maps,
                                        int height,
                                        int width) {}
Z
zhangjinchao01 已提交
72 73 74 75

inline void hl_destroy_filter_descriptor(hl_filter_descriptor filter) {}

inline void hl_create_convolution_descriptor(hl_convolution_descriptor* conv,
76 77 78 79 80
                                             hl_tensor_descriptor image,
                                             hl_filter_descriptor filter,
                                             int padding_height,
                                             int padding_width,
                                             int stride_height,
W
wanghaoshuang 已提交
81 82 83
                                             int stride_width,
                                             int dilation_h,
                                             int dilation_w) {}
Z
zhangjinchao01 已提交
84 85

inline void hl_reset_convolution_descriptor(hl_convolution_descriptor conv,
86 87 88 89 90
                                            hl_tensor_descriptor image,
                                            hl_filter_descriptor filter,
                                            int padding_height,
                                            int padding_width,
                                            int stride_height,
W
wanghaoshuang 已提交
91 92 93
                                            int stride_width,
                                            int dilation_h,
                                            int dilation_w) {}
Z
zhangjinchao01 已提交
94 95 96 97

inline void hl_destroy_convolution_descriptor(hl_convolution_descriptor conv) {}

inline void hl_conv_workspace(hl_tensor_descriptor input,
98 99 100 101 102 103 104 105
                              hl_tensor_descriptor output,
                              hl_filter_descriptor filter,
                              hl_convolution_descriptor conv,
                              int* convFwdAlgo,
                              size_t* fwdLimitBytes,
                              int* convBwdDataAlgo,
                              size_t* bwdDataLimitBytes,
                              int* convBwdFilterAlgo,
W
wanghaoshuang 已提交
106 107
                              size_t* bwdFilterLimitBytes,
                              bool useDilation) {}
Z
zhangjinchao01 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120

inline void hl_convolution_forward(hl_tensor_descriptor input,
                                   real* input_data,
                                   hl_tensor_descriptor output,
                                   real* output_data,
                                   hl_filter_descriptor filter,
                                   real* filter_data,
                                   hl_convolution_descriptor conv,
                                   void* gpuWorkSpace,
                                   size_t sizeInBytes,
                                   int convFwdAlgo) {}

inline void hl_convolution_forward_add_bias(hl_tensor_descriptor bias,
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
                                            real* bias_data,
                                            hl_tensor_descriptor output,
                                            real* output_data) {}

inline void hl_convolution_backward_filter(hl_tensor_descriptor input,
                                           real* input_data,
                                           hl_tensor_descriptor output,
                                           real* output_grad_data,
                                           hl_filter_descriptor filter,
                                           real* filter_grad_data,
                                           hl_convolution_descriptor conv,
                                           void* gpuWorkSpace,
                                           size_t sizeInBytes,
                                           int convBwdFilterAlgo) {}

inline void hl_convolution_backward_data(hl_tensor_descriptor input,
                                         real* input_data_grad,
                                         hl_tensor_descriptor output,
                                         real* output_grad_data,
                                         hl_filter_descriptor filter,
                                         real* filter_data,
                                         hl_convolution_descriptor conv,
                                         void* gpuWorkSpace,
                                         size_t sizeInBytes,
                                         int convBwdDataAlgo) {}
Z
zhangjinchao01 已提交
146 147

inline void hl_convolution_backward_bias(hl_tensor_descriptor bias,
148 149 150
                                         real* bias_grad_data,
                                         hl_tensor_descriptor output,
                                         real* output_grad_data) {}
Z
zhangjinchao01 已提交
151

152 153
inline void hl_softmax_forward(real* input,
                               real* output,
Z
zhangjinchao01 已提交
154 155 156
                               int height,
                               int width) {}

157 158 159 160 161
inline void hl_softmax_backward(real* output_value,
                                real* output_grad,
                                int height,
                                int width) {}

Z
zhangjinchao01 已提交
162
inline void hl_batch_norm_forward_training(hl_tensor_descriptor inputDesc,
163
                                           real* input,
Z
zhangjinchao01 已提交
164
                                           hl_tensor_descriptor outputDesc,
165
                                           real* output,
Z
zhangjinchao01 已提交
166
                                           hl_tensor_descriptor bnParamDesc,
167 168
                                           real* scale,
                                           real* bias,
Z
zhangjinchao01 已提交
169
                                           double factor,
170 171
                                           real* runningMean,
                                           real* runningInvVar,
Z
zhangjinchao01 已提交
172
                                           double epsilon,
173 174
                                           real* savedMean,
                                           real* savedVar) {}
Z
zhangjinchao01 已提交
175 176

inline void hl_batch_norm_forward_inference(hl_tensor_descriptor inputDesc,
177
                                            real* input,
Z
zhangjinchao01 已提交
178
                                            hl_tensor_descriptor outputDesc,
179
                                            real* output,
Z
zhangjinchao01 已提交
180
                                            hl_tensor_descriptor bnParamDesc,
181 182 183 184
                                            real* scale,
                                            real* bias,
                                            real* estimatedMean,
                                            real* estimatedVar,
Z
zhangjinchao01 已提交
185 186 187
                                            double epsilon) {}

inline void hl_batch_norm_backward(hl_tensor_descriptor inputDesc,
188
                                   real* input,
Z
zhangjinchao01 已提交
189
                                   hl_tensor_descriptor outGradDesc,
190
                                   real* outGrad,
Z
zhangjinchao01 已提交
191
                                   hl_tensor_descriptor inGradDesc,
192
                                   real* inGrad,
Z
zhangjinchao01 已提交
193
                                   hl_tensor_descriptor dBnParamDesc,
194 195 196
                                   real* scale,
                                   real* scaleGrad,
                                   real* biasGrad,
Z
zhangjinchao01 已提交
197
                                   double epsilon,
198 199
                                   real* savedMean,
                                   real* savedInvVar) {}
Z
zhangjinchao01 已提交
200 201

#endif  // HL_CUDA_CUDNN_STUB_H_