From d00f0a1ccd2a9b1c332bbf7754f291dd61dee14f Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Tue, 21 Jul 2015 23:09:33 +0000
Subject: [PATCH] Changes to make routing work better
---
src/detection_layer.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/detection_layer.c b/src/detection_layer.c
index 9ef89d9..6a25819 100644
--- a/src/detection_layer.c
+++ b/src/detection_layer.c
@@ -141,20 +141,20 @@
float scale = 1;
float latent_delta = 0;
if(l.joint) scale = state.input[in_i++];
- else if (l.objectness) state.delta[in_i++] = -l.delta[out_i++];
- else if (l.background) state.delta[in_i++] = scale*l.delta[out_i++];
+ else if (l.objectness) state.delta[in_i++] += -l.delta[out_i++];
+ else if (l.background) state.delta[in_i++] += scale*l.delta[out_i++];
for(j = 0; j < l.classes; ++j){
latent_delta += state.input[in_i]*l.delta[out_i];
- state.delta[in_i++] = scale*l.delta[out_i++];
+ state.delta[in_i++] += scale*l.delta[out_i++];
}
if (l.objectness) {
}else if (l.background) gradient_array(l.output + out_i, l.coords, LOGISTIC, l.delta + out_i);
for(j = 0; j < l.coords; ++j){
- state.delta[in_i++] = l.delta[out_i++];
+ state.delta[in_i++] += l.delta[out_i++];
}
- if(l.joint) state.delta[in_i-l.coords-l.classes-l.joint] = latent_delta;
+ if(l.joint) state.delta[in_i-l.coords-l.classes-l.joint] += latent_delta;
}
}
@@ -198,7 +198,8 @@
cpu_state.truth = truth_cpu;
cpu_state.delta = delta_cpu;
- cuda_pull_array(state.input, in_cpu, l.batch*l.inputs);
+ cuda_pull_array(state.input, in_cpu, l.batch*l.inputs);
+ cuda_pull_array(state.delta, delta_cpu, l.batch*l.inputs);
cuda_pull_array(l.delta_gpu, l.delta, l.batch*outputs);
backward_detection_layer(l, cpu_state);
cuda_push_array(state.delta, delta_cpu, l.batch*l.inputs);
--
Gitblit v1.10.0