diff options
author | Charles Xu <charles.xu@arm.com> | 2020-07-02 15:12:40 +0200 |
---|---|---|
committer | Fredrik Knutsson <fredrik.knutsson.hunnebo@gmail.com> | 2020-08-05 10:45:33 +0000 |
commit | 9a03fdff316662be69a1adc4e391e43bc6519b08 (patch) | |
tree | 6608df66254a762da1660693ee36481e76e97b8c /ethosu/vela/register_command_stream_generator.py | |
parent | 0430882a652368d1da1638114d4fbf8c8f7c8d7b (diff) | |
download | ethos-u-vela-9a03fdff316662be69a1adc4e391e43bc6519b08.tar.gz |
MLBEDSW-2569:Support 1x1 IFM ResizeBilinear
Signed-off-by: Charles Xu <charles.xu@arm.com>
Change-Id: I44428d77b2e8e44a477e5c4dfe28ab8dd1792838
Diffstat (limited to 'ethosu/vela/register_command_stream_generator.py')
-rw-r--r-- | ethosu/vela/register_command_stream_generator.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/ethosu/vela/register_command_stream_generator.py b/ethosu/vela/register_command_stream_generator.py index d32766b0..38b40ba5 100644 --- a/ethosu/vela/register_command_stream_generator.py +++ b/ethosu/vela/register_command_stream_generator.py @@ -478,6 +478,11 @@ def generate_register_command_stream(nng, sg, arch, verbose=False): if (faf == "Sigmoid") or (faf == "Tanh"): output_scale = 1 / 0x3000 + # Force output scale same as the input scale for + # resizebiliner 1x1 that is converted to add + if "resizebilinear" in primary_op.attrs: + output_scale = input2_scale + if input_scale == input2_scale: opa_scale, opb_scale, ofm_scale, shift = scaling.simplified_elementwise_add_sub_scale( input_scale, input2_scale, output_scale @@ -860,7 +865,17 @@ def generate_register_command_stream(nng, sg, arch, verbose=False): emit.cmd0_with_param(zero_point_op, 0) else: assert tens.quantization.zero_point is not None, "need an actual zero point set" - emit.cmd0_with_param(zero_point_op, int(tens.quantization.zero_point)) + if ( + "resizebilinear" in primary_op.attrs + and primary_op.type == "AddAct" + and cmd0.NPU_SET_OFM_ZERO_POINT == zero_point_op + ): + # Force output zero point same as the input zero point + # for resizebiliner 1x1 that is converted to add + zero_point = cmd.ifm2_tensor.quantization.zero_point + else: + zero_point = tens.quantization.zero_point + emit.cmd0_with_param(zero_point_op, int(zero_point)) if tens.shape == []: # Empty shape, elementwise constant |