Beispiel #1
0
    def save(self, dirname: str):
        os.makedirs(dirname, exist_ok=True)

        with open(path.join(dirname, "graph_{}.json".format(self.backend_suffix)), "w") as f:
            json.dump(self.descriptor, f, indent=2)

        with open(path.join(dirname, "weight_{}.bin".format(self.backend_suffix)), "wb") as f:
            f.write(self.constants)
Beispiel #2
0
    def save(self, dirname: str):
        os.makedirs(dirname, exist_ok=True)

        for max_texture_size, (descriptor, constant_bytes) in self.data_dict.items():
            with open(path.join(dirname, f"graph_{self.backend_suffix}_{max_texture_size}.json"), "w") as f:
                json.dump(descriptor, f, indent=2)

            with open(path.join(dirname, f"weight_{self.backend_suffix}_{max_texture_size}.bin"), "wb") as f:
                f.write(constant_bytes)
Beispiel #3
0
    def clean_up_callback(cls):
        if len(cls.cases) == 0:
            return

        with open(path.join(cls.OUTPUT_ROOT, "./master.json"), "w") as f:
            json.dump(cls.cases, f)

        if cls.use_separate_data:
            with open(path.join(cls.OUTPUT_ROOT, "./master.json.bin"),
                      "wb") as f:
                f.write(cls.concatenated_data)
Beispiel #4
0
    def save(self, dirname: str):
        os.makedirs(dirname, exist_ok=True)

        with open(path.join(dirname, "graph_{}.json".format(self.backend_suffix)), "w") as f:
            json.dump(self.descriptor, f, indent=2)

        with open(path.join(dirname, "kernels_{}.cpp".format(self.backend_suffix)), "w") as f:
            f.write(self.descriptor.concat_kernel_sources())

        with open(path.join(dirname, "weight_{}.bin".format(self.backend_suffix)), "wb") as f:
            f.write(self.constants)

        self._compile(dirname)
        self._compile_fallback_asmjs(dirname)
Beispiel #5
0
    def clean_up_callback(cls):
        if len(cls.cases) == 0:
            return

        with open(path.join(cls.OUTPUT_ROOT, "./master.json"), "w") as f:
            json.dump(cls.cases, f)