From ca4b5eb03d922cb479ff07811965dcd49e97364b Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Sun, 7 Apr 2019 00:40:19 +0300 Subject: [PATCH] Bug fix with assert() during training --- build/darknet/darknet.vcxproj | 5 ++--- src/network_kernels.cu | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/darknet/darknet.vcxproj b/build/darknet/darknet.vcxproj index 29d69fe3..787602d5 100644 --- a/build/darknet/darknet.vcxproj +++ b/build/darknet/darknet.vcxproj @@ -133,13 +133,12 @@ true true $(OPENCV_DIR)\include;C:\opencv_3.0\opencv\build\include;..\..\include;..\..\3rdparty\stb\include;..\..\3rdparty\pthreads\include;%(AdditionalIncludeDirectories);$(CudaToolkitIncludeDir);$(CUDNN)\include;$(cudnn)\include - OPENCV;CUDNN_HALF;CUDNN;_TIMESPEC_DEFINED;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + OPENCV;CUDNN_HALF;CUDNN;_TIMESPEC_DEFINED;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;_CONSOLE;_LIB;%(PreprocessorDefinitions) c11 c++1y CompileAsCpp Default - - + NDEBUG true diff --git a/src/network_kernels.cu b/src/network_kernels.cu index b5f0f7db..9162c8b2 100644 --- a/src/network_kernels.cu +++ b/src/network_kernels.cu @@ -161,11 +161,12 @@ void forward_backward_network_gpu(network net, float *x, float *y) for (i = 0; i < net.n; ++i) { layer l = net.layers[i]; if (net.cudnn_half){ - assert((l.c*l.n*l.size*l.size) > 0); if (l.type == CONVOLUTIONAL && l.weights_gpu && l.weights_gpu16) { + assert((l.c*l.n*l.size*l.size) > 0); cuda_convert_f32_to_f16(l.weights_gpu, l.c*l.n*l.size*l.size, l.weights_gpu16); } else if (l.type == CRNN && l.input_layer->weights_gpu && l.input_layer->weights_gpu16) { + assert((l.input_layer->c*l.input_layer->n*l.input_layer->size*l.input_layer->size) > 0); cuda_convert_f32_to_f16(l.input_layer->weights_gpu, l.input_layer->nweights, l.input_layer->weights_gpu16); cuda_convert_f32_to_f16(l.self_layer->weights_gpu, l.self_layer->nweights, l.self_layer->weights_gpu16); cuda_convert_f32_to_f16(l.output_layer->weights_gpu, l.output_layer->nweights, l.output_layer->weights_gpu16);