@@ -54,13 +54,13 @@ at::Tensor AtenIpexCPUDev::dil_convolution(
5454
5555 std::vector<float > output_scale = {};
5656 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
57- std::vector<float > scales;
57+ std::vector<std::vector< float > > scales;
5858 bool quantized;
59- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ false );
59+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ false );
6060 // quantized = false;
6161 if (quantized) {
62- output_scale.push_back (scales[1 ]);
63- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
62+ output_scale.push_back (scales[1 ][ 0 ] );
63+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
6464 dbl::comm::reorder_to_int8_for_mix_prec (weight, {});
6565 } else {
6666 dbl::comm::reorder_to_dtype (input, at::kFloat );
@@ -103,7 +103,7 @@ at::Tensor AtenIpexCPUDev::dil_convolution(
103103 auto aten_output = dbl::comm::gen_aten_tensor_by (std::move (dil_output));
104104
105105 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
106- insert_or_updata_observer (input, aten_output, " Convolution" );
106+ insert_or_updata_observer ({ input}, { aten_output} , " Convolution" );
107107 }
108108
109109 return aten_output;
@@ -761,13 +761,13 @@ at::Tensor AtenIpexCPUDev::dil_linear(
761761
762762 std::vector<float > output_scale = {};
763763 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
764- std::vector<float > scales;
764+ std::vector<std::vector< float > > scales;
765765 bool quantized;
766- std::tie (scales, quantized) = dbl::comm::get_int8_scales (self, /* uint8_used for output*/ false );
766+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ self} , /* uint8_used for output*/ false );
767767 // quantized = false;
768768 if (quantized) {
769- output_scale.push_back (scales[1 ]);
770- dbl::comm::reorder_to_int8_for_mix_prec (self, { scales[0 ]} );
769+ output_scale.push_back (scales[1 ][ 0 ] );
770+ dbl::comm::reorder_to_int8_for_mix_prec (self, scales[0 ]);
771771 dbl::comm::reorder_to_int8_for_mix_prec (weight, {});
772772 } else {
773773 dbl::comm::reorder_to_dtype (self, at::kFloat );
@@ -797,7 +797,7 @@ at::Tensor AtenIpexCPUDev::dil_linear(
797797 auto aten_output = dbl::comm::gen_aten_tensor_by (std::move (y));
798798
799799 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
800- insert_or_updata_observer (self, aten_output, " Linear" );
800+ insert_or_updata_observer ({ self}, { aten_output} , " Linear" );
801801 }
802802
803803 if (self.dim () > 2 ) {
@@ -955,12 +955,12 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> AtenIpexCPUDev::dil_native_batch_
955955 std::vector<float > output_scales = {};
956956 bool quantized = false ;
957957 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
958- std::vector<float > scales;
959- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ false );
958+ std::vector<std::vector< float > > scales;
959+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ false );
960960 // quantized = false;
961961 if (quantized) {
962- input_scales. push_back ( scales[0 ]) ;
963- output_scales. push_back ( scales[1 ]) ;
962+ input_scales = scales[0 ];
963+ output_scales = scales[1 ];
964964 dbl::comm::reorder_to_int8_for_mix_prec (input, input_scales);
965965 } else {
966966 dbl::comm::reorder_to_dtype (input, at::kFloat );
@@ -1005,9 +1005,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> AtenIpexCPUDev::dil_native_batch_
10051005
10061006 auto aten_output = dbl::comm::gen_aten_tensor_by (std::move (y));
10071007
1008- // dbl::comm::reorder_to_dtype(aten_output, at::kFloat);
10091008 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1010- insert_or_updata_observer (input, aten_output, " BatchNorm" );
1009+ insert_or_updata_observer ({ input}, { aten_output} , " BatchNorm" );
10111010 }
10121011
10131012 return std::make_tuple (aten_output, at::Tensor (), at::Tensor ());
@@ -1060,12 +1059,12 @@ at::Tensor AtenIpexCPUDev::dil_max_pooling(
10601059 DEBUG (" AtenIpexCPUDev::dil_max_pooling\n " );
10611060 CHECK_DNNL_OP_PRE_COND (input);
10621061 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
1063- std::vector<float > scales;
1062+ std::vector<std::vector< float > > scales;
10641063 bool quantized;
1065- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ false );
1064+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ false );
10661065 // quantized = false;
10671066 if (quantized) {
1068- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
1067+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
10691068 } else {
10701069 dbl::comm::reorder_to_dtype (input, at::kFloat );
10711070 }
@@ -1074,7 +1073,7 @@ at::Tensor AtenIpexCPUDev::dil_max_pooling(
10741073 }
10751074
10761075 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1077- insert_or_updata_observer (input, at::Tensor () , " MaxPooling" );
1076+ insert_or_updata_observer ({ input}, {input} , " MaxPooling" );
10781077 }
10791078 return dbl::pool::_dil_pooling (
10801079 input,
@@ -1100,12 +1099,12 @@ at::Tensor AtenIpexCPUDev::dil_avg_pool2d(
11001099 " dil_avg_pooling operator does not support divisor" );
11011100
11021101 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
1103- std::vector<float > scales;
1102+ std::vector<std::vector< float > > scales;
11041103 bool quantized;
1105- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ false );
1104+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ false );
11061105 // quantized = false;
11071106 if (quantized) {
1108- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
1107+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
11091108 } else {
11101109 dbl::comm::reorder_to_dtype (input, at::kFloat );
11111110 }
@@ -1114,7 +1113,7 @@ at::Tensor AtenIpexCPUDev::dil_avg_pool2d(
11141113 }
11151114
11161115 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1117- insert_or_updata_observer (input, at::Tensor () , " AvgPool2d" );
1116+ insert_or_updata_observer ({ input}, {input} , " AvgPool2d" );
11181117 }
11191118
11201119 return dbl::pool::_dil_pooling (
@@ -1161,12 +1160,12 @@ at::Tensor AtenIpexCPUDev::dil_adaptive_avg_pool2d(
11611160 CHECK_DNNL_OP_PRE_COND (input);
11621161
11631162 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
1164- std::vector<float > scales;
1163+ std::vector<std::vector< float > > scales;
11651164 bool quantized;
1166- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ false );
1165+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ false );
11671166 // quantized = false;
11681167 if (quantized) {
1169- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
1168+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
11701169 } else {
11711170 dbl::comm::reorder_to_dtype (input, at::kFloat );
11721171 }
@@ -1195,7 +1194,7 @@ at::Tensor AtenIpexCPUDev::dil_adaptive_avg_pool2d(
11951194 }
11961195
11971196 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1198- insert_or_updata_observer (input, at::Tensor () , " AdaptiveAvgPool2d" );
1197+ insert_or_updata_observer ({ input}, {input} , " AdaptiveAvgPool2d" );
11991198 }
12001199 return dbl::pool::_dil_pooling (
12011200 input,
@@ -1343,12 +1342,12 @@ at::Tensor AtenIpexCPUDev::dil_relu(const at::Tensor& input) {
13431342 DEBUG (" AtenIpexCPUDev::dil_relu\n " );
13441343 CHECK_DNNL_OP_PRE_COND (input);
13451344 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
1346- std::vector<float > scales;
1345+ std::vector<std::vector< float > > scales;
13471346 bool quantized;
1348- std::tie (scales, quantized)= dbl::comm::get_int8_scales (input, /* uint8_used for output*/ true );
1347+ std::tie (scales, quantized)= dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ true );
13491348 // quantized = false;
13501349 if (quantized) {
1351- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
1350+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
13521351 } else {
13531352 dbl::comm::reorder_to_dtype (input, at::kFloat );
13541353 }
@@ -1362,7 +1361,7 @@ at::Tensor AtenIpexCPUDev::dil_relu(const at::Tensor& input) {
13621361 x, y, dil::algorithm::eltwise_relu, dil::prop_kind::forward_training, /* alpha*/ 0.0 );
13631362
13641363 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1365- insert_or_updata_observer (input, at::Tensor () , " Relu" );
1364+ insert_or_updata_observer ({ input}, {input} , " Relu" );
13661365 }
13671366
13681367 return dbl::comm::gen_aten_tensor_by (std::move (y));
@@ -1373,12 +1372,12 @@ at::Tensor& AtenIpexCPUDev::dil_relu_(at::Tensor& input) {
13731372 CHECK_DNNL_OP_PRE_COND (input);
13741373
13751374 if (check_auto_mix_int8_fp32 () && !check_int8_calibration ()) {
1376- std::vector<float > scales;
1375+ std::vector<std::vector< float > > scales;
13771376 bool quantized;
1378- std::tie (scales, quantized) = dbl::comm::get_int8_scales (input, /* uint8_used for output*/ true );
1377+ std::tie (scales, quantized) = dbl::comm::get_int8_scales ({ input} , /* uint8_used for output*/ true );
13791378 // quantized = false;
13801379 if (quantized) {
1381- dbl::comm::reorder_to_int8_for_mix_prec (input, { scales[0 ]} );
1380+ dbl::comm::reorder_to_int8_for_mix_prec (input, scales[0 ]);
13821381 } else {
13831382 dbl::comm::reorder_to_dtype (input, at::kFloat );
13841383 }
@@ -1387,7 +1386,7 @@ at::Tensor& AtenIpexCPUDev::dil_relu_(at::Tensor& input) {
13871386 }
13881387
13891388 if (check_auto_mix_int8_fp32 () && check_int8_calibration ()) {
1390- insert_or_updata_observer (input, at::Tensor () , " Relu_" );
1389+ insert_or_updata_observer ({ input}, {input} , " Relu_" );
13911390 }
13921391
13931392 auto dil_self = dbl::comm::try_gen_dil_tensor (input);
0 commit comments