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

Function xpackInit

software/init/xi_init.cpp:1878–1935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1876}
1877
1878void xpackInit(XlayerData *xlayer_seq, xChangeLayer *currentLayer)
1879{
1880#if EN_DEBUG_INIT_PRINT
1881 cout<<"xpackInit Start : "<<endl;
1882#endif
1883
1884 vector<int> topShape = xlayer_seq->hw_ops->topShape[0];
1885 vector<int> bottomShape = xlayer_seq->hw_ops->bottomShape[0];
1886 int *scalar_pack_args = (int *)currentLayer->params;
1887 int s_cnt=0;
1888 for(int it=1;it<bottomShape.size();it++){
1889 scalar_pack_args[s_cnt]=bottomShape.at(it);
1890 s_cnt++;
1891 }
1892 for(int it=1;it<topShape.size();it++){
1893 scalar_pack_args[s_cnt]=topShape.at(it);
1894 s_cnt++;
1895 }
1896
1897 scalar_pack_args[8] = xlayer_seq->hw_ops->xpack_params->pack;
1898 scalar_pack_args[9] = xlayer_seq->hw_ops->xpack_params->fbits;
1899
1900#if (IO_TYPE==16)
1901 scalar_pack_args[9] = scalar_pack_args[9] - 1;
1902#endif
1903
1904 float th_layer_in = xlayer_seq->hw_ops->th_layer_in;
1905 //th_layer_in =165.620995617;
1906 currentLayer->float_params.push_back(th_layer_in);
1907 currentLayer->string_args.push_back(xlayer_seq->hw_ops->quantization_scheme);
1908
1909 int ip_bw = xlayer_seq->hw_ops->ip_bw;
1910 float sf_in = th_layer_in / (pow(2, ip_bw - 1) - 1);
1911 currentLayer->float_params.push_back(sf_in);
1912
1913 // scalar_pack_args[0] = bottomShape.at(1);
1914 // scalar_pack_args[1] = bottomShape.at(2);
1915 // scalar_pack_args[2] = bottomShape.at(3);
1916 // scalar_pack_args[3] = topShape.at(1);
1917 // scalar_pack_args[4] = topShape.at(2);
1918 // scalar_pack_args[5] = topShape.at(3);
1919 currentLayer->kernType = XPACK;
1920
1921 string quant_scheme = xlayer_seq->hw_ops->quantization_scheme;
1922 if(quant_scheme.compare("Xilinx") == 0)
1923 {
1924 currentLayer->kernMode = OFFLINE;
1925 }
1926 else
1927 {
1928 currentLayer->kernMode = DYNAMIC_FIXED;
1929 }
1930
1931
1932#if EN_DEBUG_INIT_PRINT
1933 cout<<"xpackInit End : "<<endl;
1934#endif
1935}

Callers 1

initXChangeHostFunction · 0.85

Calls 4

sizeMethod · 0.45
atMethod · 0.45
push_backMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected