ResNet working

This commit is contained in:
Davide Sapienza
2019-10-29 17:21:31 +01:00
parent e9ec582223
commit 02936fa928
5 changed files with 242 additions and 317 deletions
-18
View File
@@ -20,13 +20,6 @@ LayerWgs::LayerWgs(Network *net, int inputs, int outputs,
seek += inputs*outputs*kh*kw*kl;
readBinaryFile(weights_path.c_str(), outputs, &bias_h, &bias_d, seek);
std::cout<<"w:\n";
printDeviceVector(64, data_d, true);
std::cout<<"b:\n";
printDeviceVector(64, bias_d, true);
std::cout<<"step----------------------------------------\n";
this->batchnorm = batchnorm;
if(batchnorm) {
seek += outputs;
@@ -36,17 +29,6 @@ std::cout<<"step----------------------------------------\n";
seek += outputs;
readBinaryFile(weights_path.c_str(), outputs, &variance_h, &variance_d, seek);
std::cout<<"s:\n";
printDeviceVector(64, scales_d, true);
std::cout<<"m:\n";
printDeviceVector(64, mean_d, true);
std::cout<<"v:\n";
printDeviceVector(64, variance_d, true);
std::cout<<"END----------------------------------------\n";
float eps = CUDNN_BN_MIN_EPSILON;
power_h = new dnnType[outputs];
+7 -1
View File
@@ -263,10 +263,16 @@ ILayer* NetworkRT::convert_layer(ITensor *input, Conv2d *l) {
ILayer* NetworkRT::convert_layer(ITensor *input, Pooling *l) {
//std::cout<<"convert Pooling\n";
PoolingType ptype;
if(l->pool_mode == tkdnnPoolingMode_t::POOLING_MAX) ptype = PoolingType::kMAX;
if(l->pool_mode == tkdnnPoolingMode_t::POOLING_AVERAGE) ptype = PoolingType::kAVERAGE;
if(l->pool_mode == tkdnnPoolingMode_t::POOLING_AVERAGE_EXCLUDE_PADDING) ptype = PoolingType::kMAX_AVERAGE_BLEND;
IPoolingLayer *lRT = networkRT->addPooling(*input,
PoolingType::kMAX, DimsHW{l->winH, l->winW});
ptype, DimsHW{l->winH, l->winW});
checkNULL(lRT);
lRT->setStride(DimsHW{l->strideH, l->strideW});
lRT->setPadding(DimsHW{l->paddingH, l->paddingW});
return lRT;
}
+5 -2
View File
@@ -7,9 +7,12 @@ namespace tk { namespace dnn {
Route::Route(Network *net, Layer **layers, int layers_n) : Layer(net) {
this->layers = layers;
this->layers_n = layers_n;
if(layers_n > MAX_INPUT_LAYERS)
FatalError("Route: MAX INPUT LAYERS overload");
for(int i=0; i<layers_n; i++)
this->layers[i] = layers[i];
//get dims
output_dim.l = 1;
output_dim.c = 0;