Skip to content

Commit

Permalink
Reintroduce get_target_accel_type
Browse files Browse the repository at this point in the history
Change-Id: I0aaf83fe0204c0db435692e9b92dee6e9d6997fe
  • Loading branch information
mbaret committed Sep 10, 2021
1 parent f80a062 commit 532bd2c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/tvm/relay/backend/contrib/ethosu/vela_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,17 @@ def _calculate_hw_bias_scales(
hw_bias_scales = [_quantize_scale(bs) for bs in bias_scales]

return hw_bias_scales


def get_target_accel_type():
"""This is a helper function to convert cli accelerator type str argument
to NpuAccelerator"""
npu_accel_str_map = {
"ethos-u55-256": vapi.NpuAccelerator.Ethos_U55_256,
"ethos-u55-128": vapi.NpuAccelerator.Ethos_U55_128,
"ethos-u55-64": vapi.NpuAccelerator.Ethos_U55_64,
"ethos-u55-32": vapi.NpuAccelerator.Ethos_U55_32,
}
accel_type_str = util.get_accelerator_config()
assert accel_type_str in npu_accel_str_map.keys(), f"{accel_type_str} is not supported"
return npu_accel_str_map[accel_type_str]

0 comments on commit 532bd2c

Please sign in to comment.