@@ -311,12 +311,13 @@ void TrtCommon::printNetworkInfo(const std::string & onnx_file_path)
311
311
int groups = conv->getNbGroups ();
312
312
int stride = s_dims.d [0 ];
313
313
int num_weights = (dim_in.d [1 ] / groups) * dim_out.d [1 ] * k_dims.d [0 ] * k_dims.d [1 ];
314
- float gflops = (2 * num_weights) * (dim_in.d [3 ] / stride * dim_in. d [ 2 ] / stride / 1e9 );
315
- ;
314
+ float gflops = (2.0 * num_weights) * (static_cast < float >( dim_in.d [3 ]) / stride *
315
+ static_cast < float >(dim_in. d [ 2 ]) / stride / 1e9 ) ;
316
316
total_gflops += gflops;
317
317
total_params += num_weights;
318
318
std::cout << " L" << i << " [conv " << k_dims.d [0 ] << " x" << k_dims.d [1 ] << " (" << groups
319
- << " ) " << " /" << s_dims.d [0 ] << " ] " << dim_in.d [3 ] << " x" << dim_in.d [2 ] << " x"
319
+ << " ) "
320
+ << " /" << s_dims.d [0 ] << " ] " << dim_in.d [3 ] << " x" << dim_in.d [2 ] << " x"
320
321
<< dim_in.d [1 ] << " -> " << dim_out.d [3 ] << " x" << dim_out.d [2 ] << " x"
321
322
<< dim_out.d [1 ];
322
323
std::cout << " weights:" << num_weights;
@@ -336,8 +337,10 @@ void TrtCommon::printNetworkInfo(const std::string & onnx_file_path)
336
337
} else if (p_type == nvinfer1::PoolingType::kMAX_AVERAGE_BLEND ) {
337
338
std::cout << " max avg blend " ;
338
339
}
339
- float gflops = dim_in.d [1 ] * dim_window.d [0 ] / dim_stride.d [0 ] * dim_window.d [1 ] /
340
- dim_stride.d [1 ] * dim_in.d [2 ] * dim_in.d [3 ] / 1e9 ;
340
+ float gflops = static_cast <float >(dim_in.d [1 ]) *
341
+ (static_cast <float >(dim_window.d [0 ]) / static_cast <float >(dim_stride.d [0 ])) *
342
+ (static_cast <float >(dim_window.d [1 ]) / static_cast <float >(dim_stride.d [1 ])) *
343
+ static_cast <float >(dim_in.d [2 ]) * static_cast <float >(dim_in.d [3 ]) / 1e9 ;
341
344
total_gflops += gflops;
342
345
std::cout << " pool " << dim_window.d [0 ] << " x" << dim_window.d [1 ] << " ]" ;
343
346
std::cout << " GFLOPs:" << gflops;
@@ -381,7 +384,8 @@ bool TrtCommon::buildEngineFromOnnx(
381
384
if (num_available_dla > 0 ) {
382
385
std::cout << " ###" << num_available_dla << " DLAs are supported! ###" << std::endl;
383
386
} else {
384
- std::cout << " ###Warning : " << " No DLA is supported! ###" << std::endl;
387
+ std::cout << " ###Warning : "
388
+ << " No DLA is supported! ###" << std::endl;
385
389
}
386
390
config->setDefaultDeviceType (nvinfer1::DeviceType::kDLA );
387
391
config->setDLACore (build_config_->dla_core_id );
0 commit comments