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 <dwight.lidman@arm.com>
Change-Id: I16b880b228e57f2a92fb8936f53e94886e0f9f44
diff --git a/ethosu/vela/operation.py b/ethosu/vela/operation.py
index 45fae21..32cba36 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 @@
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.