| 60 | } |
| 61 | |
| 62 | void convInit(XlayerData *xlayer_seq, xChangeLayer *currentLayer, int layer_id, file_paths *const_data_path, int &io_8bit_flag, int fc_id) |
| 63 | { |
| 64 | |
| 65 | #if EN_DEBUG_INIT_PRINT |
| 66 | cout<<"convInit Start: "<<endl; |
| 67 | #endif |
| 68 | |
| 69 | ConvolutionParameter *conv_params = xlayer_seq->hw_ops->conv_params; |
| 70 | int *scalar_conv_args = (int *)currentLayer->params; |
| 71 | |
| 72 | vector<int> bottomShape = xlayer_seq->hw_ops->bottomShape.at(0);//.blob->shape; |
| 73 | vector<int> topShape = xlayer_seq->hw_ops->topShape.at(0);//.blob->shape; |
| 74 | |
| 75 | int conv_inp_height, conv_inp_width; |
| 76 | int conv_out_height, conv_out_width; |
| 77 | int conv_inp_planes, conv_out_planes; |
| 78 | int conv_filter_height, conv_filter_width; |
| 79 | int conv_stride, conv_dilation, conv_pad, conv_group; |
| 80 | int th_in, th_out; |
| 81 | |
| 82 | scalar_conv_args[34] = xlayer_seq->opcode; //Opcode |
| 83 | |
| 84 | string quant_scheme = xlayer_seq->hw_ops->quantization_scheme; |
| 85 | |
| 86 | //cout << "Quant scheme : " << xlayer_seq->hw_ops->quantization_scheme << endl; |
| 87 | |
| 88 | //# Loading first layer threshold param |
| 89 | //# This is used for in offline quant mode for input quantization |
| 90 | float th_layer_in = 0; |
| 91 | float th_layer_out = 0; |
| 92 | float sf_in = 0; |
| 93 | float sf_out = 0; |
| 94 | |
| 95 | scalar_conv_args[127] = 0; |
| 96 | //if((layer_id == 0) && (quant_scheme.compare("Xilinx") == 0)) |
| 97 | if(quant_scheme.compare("Xilinx") == 0) |
| 98 | { |
| 99 | th_layer_in = xlayer_seq->hw_ops->th_layer_in; |
| 100 | th_layer_out = xlayer_seq->hw_ops->th_layer_out; |
| 101 | scalar_conv_args[127] = 1; //offline mode |
| 102 | |
| 103 | if((scalar_conv_args[34] == OPCODE_POOL2CONV) || (scalar_conv_args[34] == OPCODE_AVRPOOL2CONV) || (scalar_conv_args[34] == OPCODE_FC2CONV))//Checking for MAX_POOL or AVG_POOL |
| 104 | { |
| 105 | th_layer_in = conv_params->th_layer_in_3d;//39.5895589117; |
| 106 | th_layer_out = conv_params->th_layer_out_3d;//39.5895589117; |
| 107 | } |
| 108 | |
| 109 | int ip_bw = currentLayer->qf_format.ip_bw; |
| 110 | sf_in = th_layer_in / (pow(2, ip_bw - 1) - 1); |
| 111 | |
| 112 | int op_bw = currentLayer->qf_format.op_bw; |
| 113 | sf_out = th_layer_out / (pow(2, op_bw - 1) - 1); |
| 114 | |
| 115 | } |
| 116 | |
| 117 | currentLayer->float_params.push_back(th_layer_in); |
| 118 | currentLayer->float_params.push_back(th_layer_out); |
| 119 | currentLayer->float_params.push_back(sf_in); |
no test coverage detected