• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019-2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_GPU_KERNEL_CONSTANTS_H_
18 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_GPU_KERNEL_CONSTANTS_H_
19 #include <map>
20 #include <string>
21 
22 namespace mindspore {
23 namespace kernel {
24 // Used by Pooling and Conv2d
25 static constexpr char kSamePadModeUpperCase[] = "SAME";
26 
27 // Used by Pooling and Conv2d
28 static constexpr char kSamePadModeLowerCase[] = "same";
29 
30 // Used by Pooling and Conv2d
31 static constexpr char kValidPadModeUpperCase[] = "VALID";
32 
33 // Used by Pooling and Conv2d
34 static constexpr char kValidPadModeLowerCase[] = "valid";
35 
36 // Used by Pooling
37 static constexpr char kAvgPoolingModeUpperCase[] = "AVG";
38 
39 // Used by Pooling
40 static constexpr char kAvgPoolingModeLowerCase[] = "avg";
41 
42 // Used by MaxPool pad: The minimum value of float32
43 static constexpr float kSignedMinFloat = -3.402823466e+38F;
44 
45 // Used by mixprecision, cudnn dtype select
46 static std::map<std::string, cudnnDataType_t> kCudnnDtypeMap = {
47   {"kNumberTypeFloat32", CUDNN_DATA_FLOAT},  {"kNumberTypeFloat16", CUDNN_DATA_HALF},
48   {"kNumberTypeFloat64", CUDNN_DATA_DOUBLE}, {"kNumberTypeInt32", CUDNN_DATA_INT32},
49   {"kNumberTypeBool", CUDNN_DATA_INT8},      {"kNumberTypeInt8", CUDNN_DATA_INT8},
50   {"kNumberTypeUInt8", CUDNN_DATA_UINT8}};
51 // Used by mixprecision, cuda dtype select
52 static std::map<std::string, cudaDataType_t> kCudaDtypeMap = {
53   {"kNumberTypeFloat64", CUDA_R_64F}, {"kNumberTypeFloat32", CUDA_R_32F}, {"kNumberTypeFloat16", CUDA_R_16F}};
54 }  // namespace kernel
55 }  // namespace mindspore
56 
57 #endif  // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_GPU_KERNEL_CONSTANTS_H_
58