diff options
author | Michael McGeagh <michael.mcgeagh@arm.com> | 2020-12-14 15:51:20 +0000 |
---|---|---|
committer | patrik.gustavsson <patrik.gustavsson@arm.com> | 2020-12-17 17:16:02 +0000 |
commit | 168954814fb6a1cc5e7b2d44784b24402ef30199 (patch) | |
tree | 35693aeee7c291695ba83f27db7f8d81272b787c /ethosu/vela/operation_util.py | |
parent | f842b69d007e70d70fc5cef3b6f1f50b4cabbd90 (diff) | |
download | ethos-u-vela-168954814fb6a1cc5e7b2d44784b24402ef30199.tar.gz |
MLBEDSW-3694 Replace padding with enum
Use an Enum instead of a bytestring to specify VALID or SAME padding
Signed-off-by: Michael McGeagh <michael.mcgeagh@arm.com>
Change-Id: I4e87f8c32b3bfac176d822a68de061e85a558fce
Diffstat (limited to 'ethosu/vela/operation_util.py')
-rw-r--r-- | ethosu/vela/operation_util.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ethosu/vela/operation_util.py b/ethosu/vela/operation_util.py index 2fc7622c..a267b2ad 100644 --- a/ethosu/vela/operation_util.py +++ b/ethosu/vela/operation_util.py @@ -22,6 +22,7 @@ from .high_level_command_to_npu_op import ifm_ifm2_correct_order from .operation import ActivationFunction from .operation import Op from .operation import Operation +from .operation import Padding from .tensor import create_reshape_tensor from .tensor import QuantizationParameters from .tensor import Tensor @@ -29,7 +30,7 @@ from .tensor import Tensor def create_avgpool_nop(name: str) -> Operation: op = Operation(Op.AvgPool, name) - op.attrs["padding"] = b"VALID" + op.attrs["padding"] = Padding.VALID op.attrs["stride_w"] = 1 op.attrs["stride_h"] = 1 op.attrs["filter_width"] = 1 @@ -48,7 +49,7 @@ def create_depthwise_maxpool( height = ifm.shape[1] * ifm.shape[2] width = ifm.shape[3] ifm_shape = [1, height, width, 1] - op.attrs["padding"] = b"VALID" + op.attrs["padding"] = Padding.VALID op.attrs["stride_w"] = 1 op.attrs["stride_h"] = 1 op.attrs["filter_width"] = width @@ -67,7 +68,7 @@ def create_reduce_sum( name: str, ifm: Tensor, quantization: QuantizationParameters, activation: Optional[ActivationFunction] = None ) -> Operation: op = Operation(Op.ReduceSum, name) - op.attrs["padding"] = b"VALID" + op.attrs["padding"] = Padding.VALID op.attrs["stride_w"] = 1 op.attrs["stride_h"] = 1 op.attrs["filter_width"] = 1 |