diff options
author | Louis Verhaard <louis.verhaard@arm.com> | 2020-06-04 15:51:24 +0200 |
---|---|---|
committer | Tim Hall <tim.hall@arm.com> | 2020-06-18 17:53:52 +0100 |
commit | b2fb212216eaa29b96ddf270a0392172265ff02c (patch) | |
tree | e2ed4f847c267fd6d01765cab5faadc263593bf9 /ethosu/vela/mark_tensors.py | |
parent | 3c07c97e0202c1cf01eba06c24b37a8f15ff7a7c (diff) | |
download | ethos-u-vela-b2fb212216eaa29b96ddf270a0392172265ff02c.tar.gz |
MLBEDSW-2420: Improved support for dilated convolution
- Dilation added to SET_KERNEL_STRIDE instruction
- Kernel height/width adjusted for dilation
- Updated padding calculation
- Updated weight compression
Change-Id: I0c8190223e223b039a305aba0f37896ae1de2b80
Signed-off-by: Louis Verhaard <louis.verhaard@arm.com>
Diffstat (limited to 'ethosu/vela/mark_tensors.py')
-rw-r--r-- | ethosu/vela/mark_tensors.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/ethosu/vela/mark_tensors.py b/ethosu/vela/mark_tensors.py index cd70446b..bf7bc45f 100644 --- a/ethosu/vela/mark_tensors.py +++ b/ethosu/vela/mark_tensors.py @@ -17,7 +17,6 @@ # Mark purpose and select formats for Tensors. Also compresses the weights. from . import rewrite_graph from . import weight_compressor -from .operation import NpuBlockType from .tensor import TensorFormat from .tensor import TensorPurpose @@ -319,14 +318,6 @@ def mark_tensor_format(nng, arch, verbose_tensor_format=False): assert 0, "unknown tensor purpose %s" % (tens.purpose,) return fmt - def find_npu_usage_of_tensor(tens): - for op in tens.consumers(): - if op.type == "DMA": - return find_npu_usage_of_tensor(op.outputs[0]) - if "npu_block_type" in op.attrs: - return op.attrs["npu_block_type"] - return NpuBlockType.Default - def visit_tens(tens, ps): if tens not in formats_for_tensor: fmt = init_tens(tens) @@ -349,8 +340,9 @@ def mark_tensor_format(nng, arch, verbose_tensor_format=False): if fmt == TensorFormat.WeightsCompressed and tens.values is not None: src_tens = tens.get_dma_src_tensor() if src_tens is not None: - npu_block_type = find_npu_usage_of_tensor(tens) - weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 32, 32) + op = tens.find_npu_op() + npu_block_type = op.attrs["npu_block_type"] + weight_compressor.compress_weights(arch, nng, tens, npu_block_type, 32, 32, op.get_dilation_h_w()) # Alias compressed weights back into source tensor src_tens.copy_compressed_weight_info(tens) |