From 9b43f846b144d39bfb0cf16853bf6901c74b6672 Mon Sep 17 00:00:00 2001 From: Dwight Lidman Date: Tue, 8 Dec 2020 17:56:44 +0100 Subject: MLBEDSW-3653: Fix type errors in annotated files This commit corrects a number of type errors reported by mypy and refactors some parts of the code which are no longer necessary after making adjustments to satisfy mypy. Signed-off-by: Dwight Lidman Change-Id: I16b880b228e57f2a92fb8936f53e94886e0f9f44 --- ethosu/vela/operation.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ethosu/vela/operation.py') diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py index 45fae217..32cba365 100644 --- a/ethosu/vela/operation.py +++ b/ethosu/vela/operation.py @@ -18,10 +18,17 @@ import copy from collections import namedtuple from enum import Enum +from typing import Any +from typing import Dict +from typing import List from typing import Optional +from typing import TYPE_CHECKING from .numeric_util import full_shape +if TYPE_CHECKING: + from .tensor import Tensor + PointXY = namedtuple("PointXY", "x y") PointXYZ = namedtuple("PointXYZ", "x y z") @@ -392,9 +399,9 @@ class Operation: def __init__(self, op_type: Op, name: str): self.type = op_type self.name = name - self.attrs = {} - self.inputs = [] - self.outputs = [] + self.attrs: Dict[str, Any] = {} + self.inputs: List[Tensor] = [] + self.outputs: List[Tensor] = [] self.flops = 0 self.run_on_npu = True # Fused activation function. If not none: operator code. -- cgit v1.2.1