Skip to content

Commit

Permalink
Fix typing failures with ignores
Browse files Browse the repository at this point in the history
Change-Id: I81513f112a42b93cfdd3bcaf8e8852dd60ffe9e9
  • Loading branch information
mbaret committed Sep 9, 2021
1 parent c82e2f7 commit 9923074
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions python/tvm/relay/backend/contrib/ethosu/tir/passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
# under the License.
# pylint: disable=invalid-name, unused-argument
"""The TIR passes to be run on Arm(R) Ethos(TM)-U NPU TIR Compiler"""
import numpy as np
from typing import Dict
import numpy as np # type: ignore

import tvm
from tvm.relay.backend.contrib.ethosu import vela_api
Expand Down Expand Up @@ -216,7 +217,7 @@ def DivideConstants(const_dict):
The purpose of this pass is to transform the IR into a form we can apply
constant encoding to (which will compress weights and encode biases)."""
buffer_to_const = {}
buffer_to_const = {} # type: ignore
new_buffers = []
new_consts = []
keep_buffers = set()
Expand Down Expand Up @@ -253,7 +254,7 @@ def _ftransform(f, mod, ctx):

new_body = tvm.tir.stmt_functor.ir_transform(f.body, _visit, None, ["tir.Call"])
# Both the params and buffer map need updating for the newly introduced buffers
new_params = []
new_params = [] # type: ignore
new_buffer_map = {}
for i, param in enumerate(f.params):
buffer = f.buffer_map[param]
Expand Down Expand Up @@ -299,7 +300,7 @@ def EncodeConstants(const_dict):
pointer_to_buffer = {}
rewrite_buffer = {}
rewrite_pointer = {}
accel_type = vela_api.get_target_accel_type()
accel_type = vela_api.get_target_accel_type() # type: ignore

def _align_scale_bias(tir_extern_call, bias):
"""Align the scale_bias to 16 bytes."""
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/relay/backend/contrib/ethosu/tir/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def copy_constants():
"""

def _planner(te_graph, const_dict, sch):
planned = set()
planned = set() # type: ignore

def _visit(tensor, reader):
if tensor is not planned:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from typing import NamedTuple
from enum import auto
from enum import Enum
import numpy as np
import ethosu.vela.api as vapi
import numpy as np # type: ignore
import ethosu.vela.api as vapi # type: ignore

import tvm
from tvm.relay.backend.contrib.ethosu import vela_api
Expand Down Expand Up @@ -165,7 +165,7 @@ def _create_npu_op_conv2d(serial_2d_convolution):
_convert_clip_bounds(npu_conv2d_op)

npu_conv2d_op.upscale = _create_npu_resampling_mode(serial_2d_convolution.upscale)
target_accel_type = vela_api.get_target_accel_type()
target_accel_type = vela_api.get_target_accel_type() # type: ignore
block_config = vela_api.get_optimal_block_config(npu_conv2d_op, target_accel_type)
npu_conv2d_op.block_config = block_config
weights_shape_ohwi = [
Expand Down

0 comments on commit 9923074

Please sign in to comment.