MCPcopy Create free account
hub / github.com/Xilinx/CHaiDNN / softmaxInit

Function softmaxInit

software/init/xi_init.cpp:1322–1367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1320}
1321
1322void softmaxInit(XlayerData *xlayer_seq, xChangeLayer *currentLayer)
1323{
1324#if EN_DEBUG_INIT_PRINT
1325 cout<<"softmaxInit Start : "<<endl;
1326#endif
1327
1328 vector<int> bottomShape = xlayer_seq->hw_ops->bottomShape.at(0);//.blob->shape;
1329 vector<int> topShape = xlayer_seq->hw_ops->topShape.at(0);//.blob->shape;
1330
1331 printShape(bottomShape);
1332
1333 int *scalar_softmax_args = (int *)currentLayer->params;
1334
1335 scalar_softmax_args[0] = xlayer_seq->hw_ops->softmax_params->nclasses;//bottomShape.at(1); //out_depth
1336 scalar_softmax_args[1] = xlayer_seq->hw_ops->softmax_params->nboxes;//bottomShape.at(2); //out_depth
1337 scalar_softmax_args[2] = 0;//prev_layer_type;
1338 scalar_softmax_args[3] = XBATCH_SIZE;
1339 scalar_softmax_args[4] = currentLayer->qf_format.ip_fbits;
1340 scalar_softmax_args[5] = currentLayer->en_batch_size_one; //BATCH_SIZE_ONE_ENABLE
1341
1342
1343
1344 int ip_bw = xlayer_seq->hw_ops->ip_bw;
1345 float th_in = 0;
1346
1347 //# Flag for quantization scheme
1348 //# Set to 1 for Offline quant mode otherwise zero
1349 scalar_softmax_args[7] = 0;
1350 if(xlayer_seq->hw_ops->quantization_scheme.compare("Xilinx") == 0)
1351 {
1352 th_in = xlayer_seq->hw_ops->th_layer_in;
1353 scalar_softmax_args[7] = 1;
1354 }
1355
1356 float sf_in = th_in / (pow(2, ip_bw - 1) - 1);
1357
1358 scalar_softmax_args[8] = *((int *)(&sf_in));
1359 scalar_softmax_args[9] = *((int *)(&th_in));
1360
1361 currentLayer->kernType = SOFTMAX;
1362
1363
1364#if EN_DEBUG_INIT_PRINT
1365 cout<<"softmaxInit End : "<<endl;
1366#endif
1367}
1368
1369void deconvInit(XlayerData *xlayer_seq, xChangeLayer *currentLayer, file_paths *const_data_path)
1370{

Callers 1

initXChangeHostFunction · 0.85

Calls 3

printShapeFunction · 0.85
atMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected