MCPcopy Create free account
hub / github.com/pytorch/executorch / _convert_from_flatcc

Function _convert_from_flatcc

devtools/etdump/serialize.py:63–78  ·  view source on GitHub ↗
(etdump_flatbuffer: bytes, size_prefixed: bool = True)

Source from the content-addressed store, hash-verified

61
62
63def _convert_from_flatcc(etdump_flatbuffer: bytes, size_prefixed: bool = True) -> bytes:
64 with tempfile.TemporaryDirectory() as d:
65 _write_schema(d, ETDUMP_FLATCC_SCHEMA_NAME)
66 _write_schema(d, SCALAR_TYPE_SCHEMA_NAME)
67
68 schema_path = os.path.join(d, "{}.fbs".format(ETDUMP_FLATCC_SCHEMA_NAME))
69 bin_path = os.path.join(d, "schema.bin")
70 with open(bin_path, "wb") as bin_file:
71 bin_file.write(etdump_flatbuffer)
72 additional_args = []
73 if size_prefixed:
74 additional_args = ["--size-prefixed"]
75 _flatc_decompile(d, schema_path, bin_path, additional_args)
76 output_path = os.path.join(d, "schema.json")
77 with open(output_path, "rb") as output_file:
78 return output_file.read()
79
80
81def serialize_to_etdump_flatcc(

Callers 1

Calls 3

_flatc_decompileFunction · 0.90
_write_schemaFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected