xref: /aosp_15_r20/external/executorch/extension/training/examples/XOR/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2
3def define_common_targets():
4    """Defines targets that should be shared between fbcode and xplat.
5
6    The directory containing this targets.bzl file should also contain both
7    TARGETS and BUCK files that call this function.
8    """
9
10    runtime.cxx_binary(
11        name = "train_xor",
12        srcs = ["train.cpp"],
13        deps = [
14            "//executorch/extension/training/module:training_module",
15            "//executorch/extension/tensor:tensor",
16            "//executorch/extension/training/optimizer:sgd",
17            "//executorch/runtime/executor:program",
18            "//executorch/extension/data_loader:file_data_loader",
19            "//executorch/kernels/portable:generated_lib",
20        ],
21        external_deps = ["gflags"],
22        define_static_target = True,
23    )
24
25    runtime.python_library(
26        name = "model",
27        srcs = ["model.py"],
28        visibility = [],  # Private
29        deps = [
30            "//caffe2:torch",
31        ],
32    )
33
34    runtime.python_library(
35        name = "export_model_lib",
36        srcs = ["export_model.py"],
37        visibility = [],
38        deps = [
39            ":model",
40            "//caffe2:torch",
41            "//executorch/exir:lib",
42        ],
43    )
44
45    runtime.python_binary(
46        name = "export_model",
47        main_module = "executorch.extension.training.examples.XOR.export_model",
48        deps = [
49            ":export_model_lib",
50        ],
51    )
52