1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2 3def define_common_targets(is_fbcode = False): 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 # TODO(dbort): Find a way to make these run for ANDROID/APPLE in xplat. The 11 # android and ios test determinators don't like the reference to the model 12 # file in fbcode. See https://fburl.com/9esapdmd 13 if not runtime.is_oss and is_fbcode: 14 modules_env = { 15 # The tests use this var to find the program file to load. This uses 16 # an fbcode target path because the authoring/export tools 17 # intentionally don't work in xplat (since they're host-only tools). 18 "ET_MODULE_SIMPLE_TRAIN_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleSimpleTrain.pte])", 19 } 20 21 runtime.cxx_test( 22 name = "training_loop_test", 23 srcs = [ 24 "training_loop_test.cpp", 25 ], 26 deps = [ 27 "//executorch/runtime/executor:program", 28 "//executorch/extension/data_loader:file_data_loader", 29 "//executorch/runtime/core/exec_aten/testing_util:tensor_util", 30 "//executorch/extension/evalue_util:print_evalue", 31 "//executorch/runtime/executor/test:managed_memory_manager", 32 "//executorch/extension/training/optimizer:sgd", 33 "//executorch/extension/training/module:training_module", 34 "//executorch/kernels/portable:generated_lib", 35 ], 36 env = modules_env, 37 ) 38