From 6aa140b3c6e9917936f73bd538fce4fe20954233 Mon Sep 17 00:00:00 2001
From: AlexeyAB <alexeyab84@gmail.com>
Date: Sun, 15 Apr 2018 13:57:05 +0000
Subject: [PATCH] Disable burn_in for FP16 Tensor Cores
---
src/demo.c | 4 ++--
src/parser.c | 3 +++
src/detector.c | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/demo.c b/src/demo.c
index 65f451f..4aee54f 100644
--- a/src/demo.c
+++ b/src/demo.c
@@ -144,11 +144,11 @@
demo_classes = classes;
demo_thresh = thresh;
printf("Demo\n");
- net = parse_network_cfg_custom(cfgfile, 1);
+ net = parse_network_cfg_custom(cfgfile, 1); // set batch=1
if(weightfile){
load_weights(&net, weightfile);
}
- set_batch_network(&net, 1);
+ //set_batch_network(&net, 1);
fuse_conv_batchnorm(net);
srand(2222222);
diff --git a/src/detector.c b/src/detector.c
index a0372ab..e4687be 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -167,7 +167,7 @@
#else
loss = train_network(net, train);
#endif
- if (avg_loss < 0) avg_loss = loss;
+ if (avg_loss < 0 || avg_loss != avg_loss) avg_loss = loss; // if(-inf or nan)
avg_loss = avg_loss*.9 + loss*.1;
i = get_current_batch(net);
diff --git a/src/parser.c b/src/parser.c
index 651671b..319235a 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -636,6 +636,9 @@
char *policy_s = option_find_str(options, "policy", "constant");
net->policy = get_policy(policy_s);
net->burn_in = option_find_int_quiet(options, "burn_in", 0);
+#ifdef CUDNN_HALF
+ net->burn_in = 0;
+#endif
if(net->policy == STEP){
net->step = option_find_int(options, "step", 1);
net->scale = option_find_float(options, "scale", 1);
--
Gitblit v1.10.0