6
6
#include < iostream>
7
7
#include < sstream>
8
8
9
+ // NOLINTBEGIN(*c-arrays*)
9
10
namespace at ::native {
10
11
11
12
namespace {
@@ -101,7 +102,7 @@ std::ostream& operator<<(std::ostream & out, const TensorDescriptor& d) {
101
102
int nbDims = 0 ;
102
103
int dimA[CUDNN_DIM_MAX];
103
104
int strideA[CUDNN_DIM_MAX];
104
- cudnnDataType_t dtype;
105
+ cudnnDataType_t dtype{} ;
105
106
cudnnGetTensorNdDescriptor (d.desc (), CUDNN_DIM_MAX, &dtype, &nbDims, dimA, strideA);
106
107
out << " type = " << cudnnTypeToString (dtype) << " \n " ;
107
108
out << " nbDims = " << nbDims << " \n " ;
@@ -143,7 +144,7 @@ void FilterDescriptor::set(const at::Tensor &t, const at::MemoryFormat memory_fo
143
144
size[i] = (int ) 1 ;
144
145
}
145
146
dim = std::max (dim, pad);
146
- cudnnTensorFormat_t filter_format;
147
+ cudnnTensorFormat_t filter_format{} ;
147
148
switch (memory_format) {
148
149
case at::MemoryFormat::Contiguous:
149
150
filter_format = CUDNN_TENSOR_NCHW;
@@ -155,7 +156,8 @@ void FilterDescriptor::set(const at::Tensor &t, const at::MemoryFormat memory_fo
155
156
default :
156
157
TORCH_INTERNAL_ASSERT (false , " unsupported memory_format for cuDNN filters" );
157
158
}
158
- set (getDataType (t), (int ) dim, size, filter_format);
159
+ // NOLINTNEXTLINE(*narrowing-conversions)
160
+ set (getDataType (t), static_cast <int64_t >(dim), size, filter_format);
159
161
}
160
162
161
163
std::string cudnnMemoryFormatToString (cudnnTensorFormat_t tformat) {
@@ -175,8 +177,8 @@ std::ostream& operator<<(std::ostream & out, const FilterDescriptor& d) {
175
177
out << " FilterDescriptor " << static_cast <void *>(d.desc ()) << " \n " ;
176
178
int nbDims = 0 ;
177
179
int dimA[CUDNN_DIM_MAX];
178
- cudnnDataType_t dtype;
179
- cudnnTensorFormat_t tformat;
180
+ cudnnDataType_t dtype{} ;
181
+ cudnnTensorFormat_t tformat{} ;
180
182
cudnnGetFilterNdDescriptor (d.desc (), CUDNN_DIM_MAX, &dtype, &tformat, &nbDims, dimA);
181
183
out << " type = " << cudnnTypeToString (dtype) << " \n " ;
182
184
out << " tensor_format = " << cudnnMemoryFormatToString (tformat) << " \n " ;
@@ -193,3 +195,4 @@ std::ostream& operator<<(std::ostream & out, const FilterDescriptor& d) {
193
195
void FilterDescriptor::print () { std::cout << *this ; }
194
196
195
197
}
198
+ // NOLINTEND(*c-arrays*)
0 commit comments