Skip to content

Commit e47f373

Browse files
authored
Add generic fx-graph serializer (NPTG) (#21032)
Differential Revision: D111753288 Pull Request resolved: #21032
1 parent a05a924 commit e47f373

9 files changed

Lines changed: 3213 additions & 0 deletions

File tree

backends/native/BUCK

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
2+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
3+
4+
oncall("executorch")
5+
6+
# Export the generic fx-graph schema so it can be shipped as a package resource.
7+
runtime.export_file(
8+
name = "native_graph.fbs",
9+
src = "serialization/native_graph.fbs",
10+
visibility = ["//executorch/backends/native/..."],
11+
)
12+
13+
fbcode_target(
14+
_kind = runtime.python_library,
15+
name = "lib",
16+
typing = True,
17+
srcs = [
18+
"serialization/__init__.py",
19+
"serialization/graph_serialize.py",
20+
"serialization/schema.py",
21+
],
22+
resources = {
23+
":native_graph.fbs": "serialization/native_graph.fbs",
24+
},
25+
visibility = ["PUBLIC"],
26+
deps = [
27+
"//caffe2:torch",
28+
"//executorch/exir:lib",
29+
"//executorch/exir/_serialize:lib",
30+
],
31+
)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# pyre-strict
8+
9+
from executorch.backends.native.serialization.graph_serialize import (
10+
deserialize_graph,
11+
deserialize_program,
12+
serialize_graph,
13+
serialize_program,
14+
validate_graph,
15+
validate_method,
16+
validate_program,
17+
)
18+
19+
__all__ = [
20+
"serialize_graph",
21+
"serialize_program",
22+
"deserialize_graph",
23+
"deserialize_program",
24+
"validate_graph",
25+
"validate_method",
26+
"validate_program",
27+
]

0 commit comments

Comments
 (0)