uTensor / utensor_cgen

C++ code generator for uTensor https://utensor-cgen.readthedocs.io/en/latest/
Apache License 2.0
50 stars 40 forks source link

the snippet output is different from what quantize conv expect #20

Closed Knight-X closed 6 years ago

Knight-X commented 6 years ago

in the conv snippet, ctx.add(new RamTensor(), "out_conv_eightbit_quantized_conv:0", 2); ctx.add(new RamTensor(), "out_conv_eightbit_quantized_conv:1", 2); (output min) ctx.add(new RamTensor(), "out_conv_eightbit_quantized_conv:2", 2); (output max) ctx.push(new QntConvOp<uint8_t, uint8_t, float>({ 1, 2, 2, 1 }, VALID), { "x_quint8_const:0", "w_filter_quint8_const:0", "x_min:0", "x_max:0", "w_filter_min:0", "w_filter_max:0" }, { "out_conv_eightbit_quantized_conv:0", "out_conv_eightbit_quantized_conv:1", "out_conv_eightbit_quantized_conv:2" });

in matmul snippet, ctx.add(new RamTensor(), "z_eightbit_quantized_mat_mul:0", 2); ctx.add(new RamTensor({1}), "z_eightbit_quantized_mat_mul:1", 2); ctx.add(new RamTensor({1}), "z_eightbit_quantized_mat_mul:2", 2); ctx.push(new QntMatMulOp<uint8_t, uint8_t, int>(), { "w_quint8_const:0", "w_min:0", "w_max:0", "x_quint8_const:0", "x_min:0", "x_max:0" }, { "z_eightbit_quantized_mat_mul:0", "z_eightbit_quantized_mat_mul:1", "z_eightbit_quantized_mat_mul:2" });

The dim of output min and output max of Quantized MatMul is given by codegen , and it is as same as Quantized Conv2d. however, the second and third output does not have dim.

dboyliao commented 6 years ago

This should be fixed at develop branch. I'll close it when we merge develop into master https://github.com/uTensor/utensor_cgen/blob/develop/utensor_cgen/snippets/templates/snippets/conv2d_op.cpp