Lines Matching refs:f

70     fpaths["tflite"] = fpaths["data_folder"] / f"{params['name']}.tflite"
101 json_template_fpath = fpaths["json_template_folder"] / f"{params['json_template']}"
102 json_output_fpath = fpaths["data_folder"] / f"{params['name']}.json"
107 raise ValueError(f"Invalid tflite generator in {params['name']}")
148 raise ValueError(f"Invalid interpreter in {params['name']}")
171 fpaths[name] = fpaths["data_folder"] / f"{name}.h"
198 raise ValueError(f"Unknown op type '{op_type_string}'")
240 with output_fpath.open("wb") as f:
241 f.write(tflite_model)
289 with config_fpath.open("w+") as f:
290 f.write(header)
291 f.write("#pragma once\n\n")
295 f.write("#define " + f"{prefix}_{key} ".upper() + "{")
297 f.write(f"{v}, ")
298 f.write("}\n")
306 f.write("#define " + f"{prefix}_{key} ".upper() + f"{val}\n")
309 with test_data_fpath.open("w") as f:
310 f.write(header)
311 f.write(f'#include "{config_fpath.name}"\n')
323 print(f"WARNING: {fname} has repeating values, is this intended?")
325 print(f"WARNING: {fname} has more than 500 values, is this intended?")
327 with fname.open("w+") as f:
328 f.write(header)
329 f.write("#pragma once\n")
330 f.write("#include <stdint.h>\n\n")
336 f.write(f"const {dtype} {prefix}_{tensor_name}[{len(data)}] = \n" + "{")
340 f.write("\n")
341 f.write(f"{data[i]: {format_width}n}, ")
344 f.write("\n")
345 f.write(f"{data[len(data) - 1]: {format_width}n}" + "\n};\n")
348 f.write(f"const {dtype} *const {prefix}_{tensor_name} = NULL;\n")
350 with test_data_fpath.open("a") as f:
351 f.write(f'#include "{fname.name}"\n')
358 with fname.open("a") as f:
359 f.write(f"\nconst {dtype} *const {prefix}_{alias_name} = {prefix}_{tensor_name};\n")
369 print(f"ERROR: {command_list = }")
372 raise RuntimeError(f"{e} from: {command_list = }")
379 with test_functions_fpath.open("a") as f:
380 f.write(f'#include "../TestData/{name}/test_data.h"\n\n')
381 f.write(template)
383 with unity_fpath.open("a") as f:
384 f.write("void test_" + name + "(void) { " + name + "(); }\n")
424 output.write(f" {byte},\n")
425 output.write(f" {weights_in_bytes[-1]}\n")
434 command = f"flatc -o {json_output_fpath.parent} -c -b {schema_path} {json_output_fpath}"
439 print(f"ERROR: {command = }")
442 raise RuntimeError(f"{e} from: {command = }. Did you install flatc?")
452 header = f"// Generated by {os.path.basename(sys.argv[0])}"
454 … header += f" using tensorflow version {tf.__version__} (Keras version {keras.__version__}).\n"
465 print(f"ERROR: {command = }")
468 raise RuntimeError(f"{e} from: {command = }. Did you install flatc?")
469 header += f" using {str(flatc_version)[2:-3]}\n"
476 header += f"// Interpreter from tensorflow version {version} and revision {revision}.\n"
482 header += f"// Interpreter from tflite_runtime version {version} and revision {revision}.\n"
485 header += f"// Interpreter from tflite_micro runtime version {version}.\n"