diff --git a/test/HeaderWriter.py b/test/HeaderWriter.py index 5ccfb9b..2cb2a96 100644 --- a/test/HeaderWriter.py +++ b/test/HeaderWriter.py @@ -155,7 +155,9 @@ def generate_source(self, name, body): with open(filepath, "w") as file: file.write(body) - def generate_vector_source(self, name, size, _type, init=None, golden=None, section="PI_L1"): + def generate_vector_source( + self, name, size, _type, init=None, golden=None, section="PI_L1" + ): render = "" render += f'#include "{name}.h"\n\n' render += self.render_vector(name, f"{section} {_type}", size, init=init) @@ -168,7 +170,9 @@ def generate_vector_source(self, name, size, _type, init=None, golden=None, sect self.generate_source(name, render) - def generate_vector_files(self, name, size, _type, init=None, golden=None, section="PI_L1"): + def generate_vector_files( + self, name, size, _type, init=None, golden=None, section="PI_L1" + ): self.generate_vector_source(name, size, _type, init, golden, section) self.generate_vector_header(name, size, _type, init, golden) diff --git a/test/NeurekaTestConf.py b/test/NeurekaTestConf.py index 0cf9dac..15eef46 100644 --- a/test/NeurekaTestConf.py +++ b/test/NeurekaTestConf.py @@ -104,5 +104,7 @@ def check_valid_out_type_with_norm_quant(self) -> NeurekaTestConf: @classmethod def check_valid_wmem(cls, v: WmemLiteral) -> WmemLiteral: _supported_wmem = ["tcdm", "sram"] - assert v in _supported_wmem, f"Unsupported wmem {v}. Supported {_supported_wmem}." + assert ( + v in _supported_wmem + ), f"Unsupported wmem {v}. Supported {_supported_wmem}." return v diff --git a/test/NnxTestClasses.py b/test/NnxTestClasses.py index d5e68bb..ced8772 100644 --- a/test/NnxTestClasses.py +++ b/test/NnxTestClasses.py @@ -30,7 +30,6 @@ from NeuralEngineFunctionalModel import NeuralEngineFunctionalModel from TestClasses import IntegerType, KernelShape, Padding, Stride, implies - WmemLiteral = Literal["tcdm", "sram"] @@ -351,11 +350,15 @@ def generate(self, test_name: str, test: NnxTest): test.conf.depthwise, ) if test.conf.wmem == "sram": - section = "__attribute__((section(\".weightmem_sram\")))" + section = '__attribute__((section(".weightmem_sram")))' else: section = "PI_L1" self.header_writer.generate_vector_files( - "weight", _type="uint8_t", size=weight_init.size, init=weight_init, section=section + "weight", + _type="uint8_t", + size=weight_init.size, + init=weight_init, + section=section, ) # Render scale @@ -406,14 +409,18 @@ def generate(self, test_name: str, test: NnxTest): "offset": weight_offset, }, "scale": { - "bits": test.conf.scale_type._bits - if test.conf.scale_type is not None - else 0 + "bits": ( + test.conf.scale_type._bits + if test.conf.scale_type is not None + else 0 + ) }, "bias": { - "bits": test.conf.bias_type._bits - if test.conf.bias_type is not None - else 0 + "bits": ( + test.conf.bias_type._bits + if test.conf.bias_type is not None + else 0 + ) }, "padding": { "top": test.conf.padding.top, diff --git a/test/TestClasses.py b/test/TestClasses.py index c6267d6..fb84009 100644 --- a/test/TestClasses.py +++ b/test/TestClasses.py @@ -123,5 +123,4 @@ def model_dump( exclude_none: bool = False, round_trip: bool = False, warnings: bool = True, - ) -> dict[str, Any]: - ... + ) -> dict[str, Any]: ...