-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pyright errors and add the NnxMapping
- Loading branch information
Showing
4 changed files
with
31 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,27 @@ | ||
from typing import List, Literal, get_args | ||
from enum import Enum | ||
from typing import Dict, NamedTuple, Type | ||
|
||
from Ne16TestConf import Ne16TestConf | ||
from Ne16Weight import Ne16Weight | ||
from NeurekaTestConf import NeurekaTestConf | ||
from NeurekaWeight import NeurekaWeight | ||
from NnxTestClasses import NnxTestConf, NnxWeight | ||
|
||
NnxName = Literal["ne16", "neureka"] | ||
|
||
class NnxName(Enum): | ||
ne16 = "ne16" | ||
neureka = "neureka" | ||
|
||
def valid_nnx_names() -> List[str]: | ||
return get_args(NnxName) | ||
def __str__(self): | ||
return self.value | ||
|
||
|
||
def is_valid_nnx_name(name: str) -> bool: | ||
return name in valid_nnx_names() | ||
class NnxAcceleratorClasses(NamedTuple): | ||
testConfCls: Type[NnxTestConf] | ||
weightCls: Type[NnxWeight] | ||
|
||
|
||
def NnxWeightClsFromName(name: NnxName) -> NnxWeight: | ||
if name == "ne16": | ||
return Ne16Weight | ||
elif name == "neureka": | ||
return NeurekaWeight | ||
|
||
|
||
def NnxTestConfClsFromName(name: NnxName) -> NnxTestConf: | ||
if name == "ne16": | ||
return Ne16TestConf | ||
elif name == "neureka": | ||
return NeurekaTestConf | ||
NnxMapping: Dict[NnxName, NnxAcceleratorClasses] = { | ||
NnxName.ne16: NnxAcceleratorClasses(Ne16TestConf, Ne16Weight), | ||
NnxName.neureka: NnxAcceleratorClasses(NeurekaTestConf, NeurekaWeight), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters