9797 262144 , // 256 KB
9898 " Size of the debug buffer in bytes to allocate for intermediate outputs and program outputs logging." );
9999
100- using namespace torch ::executor;
101- using torch::executor::util::FileDataLoader;
100+ using executorch::etdump::ETDumpGen;
101+ using executorch::etdump::ETDumpResult;
102+ using executorch::extension::BufferCleanup;
103+ using executorch::extension::BufferDataLoader;
104+ using executorch::extension::FileDataLoader;
105+ using executorch::runtime::DataLoader;
106+ using executorch::runtime::EValue;
107+ using executorch::runtime::Error;
108+ using executorch::runtime::EventTracerDebugLogLevel;
109+ using executorch::runtime::FreeableBuffer;
110+ using executorch::runtime::HierarchicalAllocator;
111+ using executorch::runtime::MemoryAllocator;
112+ using executorch::runtime::MemoryManager;
113+ using executorch::runtime::Method ;
114+ using executorch::runtime::MethodMeta;
115+ using executorch::runtime::Program;
116+ using executorch::runtime::Result;
117+ using executorch::runtime::Span;
118+
119+ namespace bundled_program = executorch::bundled_program;
102120
103121int main (int argc, char ** argv) {
104122 {
@@ -113,7 +131,7 @@ int main(int argc, char** argv) {
113131 return 1 ;
114132 }
115133
116- runtime_init ();
134+ executorch::runtime:: runtime_init ();
117135
118136 gflags::ParseCommandLineFlags (&argc, &argv, true );
119137 if (argc != 1 ) {
@@ -144,20 +162,20 @@ int main(int argc, char** argv) {
144162 // Find the offset to the embedded Program.
145163 const void * program_data;
146164 size_t program_data_len;
147- Error status = torch::executor:: bundled_program::GetProgramData (
165+ Error status = bundled_program::get_program_data (
148166 const_cast <void *>(file_data->data ()),
149167 file_data->size (),
150168 &program_data,
151169 &program_data_len);
152170 ET_CHECK_MSG (
153171 status == Error::Ok,
154- " GetProgramData () failed on file '%s': 0x%x" ,
172+ " get_program_data () failed on file '%s': 0x%x" ,
155173 model_path,
156174 (unsigned int )status);
157175
158176 // Wrap the buffer in a DataLoader.
159177 auto buffer_data_loader =
160- util:: BufferDataLoader (program_data, program_data_len);
178+ BufferDataLoader (program_data, program_data_len);
161179
162180 // Parse the program file. This is immutable, and can also be reused between
163181 // multiple execution invocations across multiple threads.
@@ -239,7 +257,7 @@ HierarchicalAllocator planned_memory(
239257 // be used by a single thread at at time, but it can be reused.
240258 //
241259
242- torch::executor:: ETDumpGen etdump_gen = torch::executor::ETDumpGen() ;
260+ ETDumpGen etdump_gen;
243261 Result<Method > method =
244262 program->load_method (method_name, &memory_manager, &etdump_gen);
245263 ET_CHECK_MSG (
@@ -263,11 +281,11 @@ HierarchicalAllocator planned_memory(
263281 }
264282
265283 // Prepare the inputs.
266- std::unique_ptr<util:: BufferCleanup> inputs;
284+ std::unique_ptr<BufferCleanup> inputs;
267285 if (FLAGS_bundled_program) {
268286 ET_LOG (Info, " Loading bundled program..." );
269287 // Use the inputs embedded in the bundled program.
270- status = torch::executor:: bundled_program::LoadBundledInput (
288+ status = bundled_program::load_bundled_input (
271289 *method,
272290 file_data->data (),
273291 FLAGS_testset_idx);
@@ -278,11 +296,11 @@ HierarchicalAllocator planned_memory(
278296 } else {
279297 ET_LOG (Info, " Loading non-bundled program...\n " );
280298 // Use ones-initialized inputs.
281- auto inputs_result = torch::executor::util ::prepare_input_tensors (*method);
299+ auto inputs_result = executorch::extension ::prepare_input_tensors (*method);
282300 if (inputs_result.ok ()) {
283301 // Will free the inputs when destroyed.
284302 inputs =
285- std::make_unique<util:: BufferCleanup>(std::move (inputs_result.get ()));
303+ std::make_unique<BufferCleanup>(std::move (inputs_result.get ()));
286304 }
287305 }
288306 ET_LOG (Info, " Inputs prepared." );
@@ -322,14 +340,14 @@ HierarchicalAllocator planned_memory(
322340 status = method->get_outputs (outputs.data(), outputs.size());
323341 ET_CHECK (status == Error::Ok);
324342 // Print the first and last 100 elements of long lists of scalars.
325- std::cout << torch::executor::util ::evalue_edge_items(100 );
343+ std::cout << executorch::extension ::evalue_edge_items(100 );
326344 for (int i = 0 ; i < outputs.size(); ++i) {
327345 std::cout << " Output " << i << " : " << outputs[i] << std::endl;
328346 }
329347
330348 // Dump the etdump data containing profiling/debugging data to the specified
331349 // file.
332- etdump_result result = etdump_gen.get_etdump_data();
350+ ETDumpResult result = etdump_gen.get_etdump_data();
333351 if (result.buf != nullptr && result.size > 0 ) {
334352 FILE* f = fopen (FLAGS_etdump_path.c_str (), " w+" );
335353 fwrite ((uint8_t *)result.buf , 1 , result.size , f);
@@ -362,7 +380,7 @@ HierarchicalAllocator planned_memory(
362380 atol = 1e-01 ;
363381 rtol = 1e-01 ;
364382 }
365- status = torch::executor:: bundled_program::VerifyResultWithBundledExpectedOutput (
383+ status = bundled_program::verify_method_outputs (
366384 *method,
367385 file_data->data (),
368386 FLAGS_testset_idx,
0 commit comments