| | |
| | | #include "convolutional_layer.h" |
| | | #include "deconvolutional_layer.h" |
| | | #include "maxpool_layer.h" |
| | | #include "avgpool_layer.h" |
| | | #include "normalization_layer.h" |
| | | #include "cost_layer.h" |
| | | #include "softmax_layer.h" |
| | | #include "dropout_layer.h" |
| | | #include "route_layer.h" |
| | | #include "blas.h" |
| | | } |
| | | |
| | | float * get_network_output_gpu_layer(network net, int i); |
| | |
| | | int i; |
| | | for(i = 0; i < net.n; ++i){ |
| | | layer l = net.layers[i]; |
| | | if(l.delta_gpu){ |
| | | scal_ongpu(l.outputs * l.batch, 0, l.delta_gpu, 1); |
| | | } |
| | | if(l.type == CONVOLUTIONAL){ |
| | | forward_convolutional_layer_gpu(l, state); |
| | | } else if(l.type == DECONVOLUTIONAL){ |
| | |
| | | forward_cost_layer_gpu(l, state); |
| | | } else if(l.type == SOFTMAX){ |
| | | forward_softmax_layer_gpu(l, state); |
| | | } else if(l.type == NORMALIZATION){ |
| | | forward_normalization_layer_gpu(l, state); |
| | | } else if(l.type == MAXPOOL){ |
| | | forward_maxpool_layer_gpu(l, state); |
| | | } else if(l.type == AVGPOOL){ |
| | | forward_avgpool_layer_gpu(l, state); |
| | | } else if(l.type == DROPOUT){ |
| | | forward_dropout_layer_gpu(l, state); |
| | | } else if(l.type == ROUTE){ |
| | |
| | | backward_deconvolutional_layer_gpu(l, state); |
| | | } else if(l.type == MAXPOOL){ |
| | | if(i != 0) backward_maxpool_layer_gpu(l, state); |
| | | } else if(l.type == AVGPOOL){ |
| | | if(i != 0) backward_avgpool_layer_gpu(l, state); |
| | | } else if(l.type == DROPOUT){ |
| | | backward_dropout_layer_gpu(l, state); |
| | | } else if(l.type == DETECTION){ |
| | | backward_detection_layer_gpu(l, state); |
| | | } else if(l.type == NORMALIZATION){ |
| | | backward_normalization_layer_gpu(l, state); |
| | | } else if(l.type == SOFTMAX){ |
| | | if(i != 0) backward_softmax_layer_gpu(l, state); |
| | | } else if(l.type == CONNECTED){ |
| | |
| | | { |
| | | layer l = net.layers[i]; |
| | | cuda_pull_array(l.output_gpu, l.output, l.outputs*l.batch); |
| | | if(l.type == CONVOLUTIONAL){ |
| | | return l.output; |
| | | } else if(l.type == DECONVOLUTIONAL){ |
| | | return l.output; |
| | | } else if(l.type == CONNECTED){ |
| | | return l.output; |
| | | } else if(l.type == DETECTION){ |
| | | return l.output; |
| | | } else if(l.type == MAXPOOL){ |
| | | return l.output; |
| | | } else if(l.type == SOFTMAX){ |
| | | return l.output; |
| | | } |
| | | return 0; |
| | | return l.output; |
| | | } |
| | | |
| | | float *get_network_output_gpu(network net) |