| | |
| | | if(l.type == CONVOLUTIONAL){ |
| | | int num = l.n*l.c*l.size*l.size; |
| | | axpy_cpu(l.n, 1, l.biases, 1, out.biases, 1); |
| | | axpy_cpu(num, 1, l.filters, 1, out.filters, 1); |
| | | axpy_cpu(num, 1, l.weights, 1, out.weights, 1); |
| | | } |
| | | if(l.type == CONNECTED){ |
| | | axpy_cpu(l.outputs, 1, l.biases, 1, out.biases, 1); |
| | |
| | | if(l.type == CONVOLUTIONAL){ |
| | | int num = l.n*l.c*l.size*l.size; |
| | | scal_cpu(l.n, 1./n, l.biases, 1); |
| | | scal_cpu(num, 1./n, l.filters, 1); |
| | | scal_cpu(num, 1./n, l.weights, 1); |
| | | } |
| | | if(l.type == CONNECTED){ |
| | | scal_cpu(l.outputs, 1./n, l.biases, 1); |
| | |
| | | save_weights_upto(net, outfile, max); |
| | | } |
| | | |
| | | void stacked(char *cfgfile, char *weightfile, char *outfile) |
| | | { |
| | | gpu_index = -1; |
| | | network net = parse_network_cfg(cfgfile); |
| | | if(weightfile){ |
| | | load_weights(&net, weightfile); |
| | | } |
| | | net.seen = 0; |
| | | save_weights_double(net, outfile); |
| | | } |
| | | |
| | | #include "convolutional_layer.h" |
| | | void rescale_net(char *cfgfile, char *weightfile, char *outfile) |
| | | { |
| | |
| | | for(i = 0; i < net.n; ++i){ |
| | | layer l = net.layers[i]; |
| | | if(l.type == CONVOLUTIONAL){ |
| | | rescale_filters(l, 2, -.5); |
| | | rescale_weights(l, 2, -.5); |
| | | break; |
| | | } |
| | | } |
| | |
| | | for(i = 0; i < net.n; ++i){ |
| | | layer l = net.layers[i]; |
| | | if(l.type == CONVOLUTIONAL){ |
| | | rgbgr_filters(l); |
| | | rgbgr_weights(l); |
| | | break; |
| | | } |
| | | } |
| | |
| | | gpu_index = -1; |
| | | #else |
| | | if(gpu_index >= 0){ |
| | | cudaError_t status = cudaSetDevice(gpu_index); |
| | | check_error(status); |
| | | cuda_set_device(gpu_index); |
| | | } |
| | | #endif |
| | | |
| | |
| | | partial(argv[2], argv[3], argv[4], atoi(argv[5])); |
| | | } else if (0 == strcmp(argv[1], "average")){ |
| | | average(argc, argv); |
| | | } else if (0 == strcmp(argv[1], "stacked")){ |
| | | stacked(argv[2], argv[3], argv[4]); |
| | | } else if (0 == strcmp(argv[1], "visualize")){ |
| | | visualize(argv[2], (argc > 3) ? argv[3] : 0); |
| | | } else if (0 == strcmp(argv[1], "imtest")){ |