@@ -75,7 +75,20 @@ DEFINE_int32(
7575 262144 , // 256 KB
7676 " Size of the debug buffer in bytes to allocate for intermediate outputs and program outputs logging." );
7777
78- using namespace torch ::executor;
78+ using executorch::etdump::ETDumpGen;
79+ using executorch::etdump::ETDumpResult;
80+ using executorch::extension::BufferDataLoader;
81+ using executorch::runtime::Error;
82+ using executorch::runtime::EValue;
83+ using executorch::runtime::EventTracerDebugLogLevel;
84+ using executorch::runtime::HierarchicalAllocator;
85+ using executorch::runtime::MemoryAllocator;
86+ using executorch::runtime::MemoryManager;
87+ using executorch::runtime::Method;
88+ using executorch::runtime::MethodMeta;
89+ using executorch::runtime::Program;
90+ using executorch::runtime::Result;
91+ using executorch::runtime::Span;
7992
8093std::vector<uint8_t > load_file_or_die (const char * path) {
8194 std::ifstream file (path, std::ios::binary | std::ios::ate);
@@ -90,7 +103,7 @@ std::vector<uint8_t> load_file_or_die(const char* path) {
90103}
91104
92105int main (int argc, char ** argv) {
93- runtime_init ();
106+ executorch::runtime:: runtime_init ();
94107
95108 gflags::ParseCommandLineFlags (&argc, &argv, true );
96109 if (argc != 1 ) {
@@ -109,19 +122,18 @@ int main(int argc, char** argv) {
109122 // Find the offset to the embedded Program.
110123 const void * program_data;
111124 size_t program_data_len;
112- Error status = torch::executor:: bundled_program::GetProgramData (
125+ Error status = executorch:: bundled_program::get_program_data (
113126 reinterpret_cast <void *>(file_data.data ()),
114127 file_data.size (),
115128 &program_data,
116129 &program_data_len);
117130 ET_CHECK_MSG (
118131 status == Error::Ok,
119- " GetProgramData () failed on file '%s': 0x%x" ,
132+ " get_program_data () failed on file '%s': 0x%x" ,
120133 bundled_program_path,
121134 (unsigned int )status);
122135
123- auto buffer_data_loader =
124- util::BufferDataLoader (program_data, program_data_len);
136+ auto buffer_data_loader = BufferDataLoader (program_data, program_data_len);
125137
126138 // Parse the program file. This is immutable, and can also be reused
127139 // between multiple execution invocations across multiple threads.
@@ -202,7 +214,7 @@ int main(int argc, char** argv) {
202214 // the method can mutate the memory-planned buffers, so the method should only
203215 // be used by a single thread at at time, but it can be reused.
204216 //
205- torch::executor:: ETDumpGen etdump_gen = torch::executor::ETDumpGen () ;
217+ ETDumpGen etdump_gen;
206218 Result<Method> method =
207219 program->load_method (method_name, &memory_manager, &etdump_gen);
208220 ET_CHECK_MSG (
@@ -225,7 +237,7 @@ int main(int argc, char** argv) {
225237 EventTracerDebugLogLevel::kProgramOutputs );
226238 }
227239 // Use the inputs embedded in the bundled program.
228- status = torch::executor:: bundled_program::LoadBundledInput (
240+ status = executorch:: bundled_program::load_bundled_input (
229241 *method, file_data.data (), FLAGS_testset_idx);
230242 ET_CHECK_MSG (
231243 status == Error::Ok,
@@ -262,7 +274,7 @@ int main(int argc, char** argv) {
262274
263275 // Dump the etdump data containing profiling/debugging data to the specified
264276 // file.
265- etdump_result result = etdump_gen.get_etdump_data ();
277+ ETDumpResult result = etdump_gen.get_etdump_data ();
266278 if (result.buf != nullptr && result.size > 0 ) {
267279 FILE* f = fopen (FLAGS_etdump_path.c_str (), " w+" );
268280 fwrite ((uint8_t *)result.buf , 1 , result.size , f);
@@ -272,14 +284,13 @@ int main(int argc, char** argv) {
272284
273285 if (FLAGS_output_verification) {
274286 // Verify the outputs.
275- status =
276- torch::executor::bundled_program::VerifyResultWithBundledExpectedOutput (
277- *method,
278- file_data.data (),
279- FLAGS_testset_idx,
280- 1e-3 , // rtol
281- 1e-5 // atol
282- );
287+ status = executorch::bundled_program::verify_method_outputs (
288+ *method,
289+ file_data.data (),
290+ FLAGS_testset_idx,
291+ 1e-3 , // rtol
292+ 1e-5 // atol
293+ );
283294 ET_CHECK_MSG (
284295 status == Error::Ok,
285296 " Bundle verification failed with status 0x%" PRIx32,
0 commit comments