Skip to content

Commit 3dd6576

Browse files
Songhao Jiafacebook-github-bot
authored andcommitted
make bundled_executor_runner only for bp
Summary: bundled executor runner should only focus on bundled program. remove the support for normal ExecuTorch Program. Differential Revision: D49761307
1 parent 4b2f0b7 commit 3dd6576

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

examples/bundled_executor_runner/bundled_executor_runner.cpp

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ DEFINE_string(
4444
"prof_result.bin",
4545
"ExecuTorch profiler output path.");
4646

47-
DEFINE_bool(
48-
bundled_program,
49-
false,
50-
"True for running bundled program, false for executorch_flatbuffer::program");
51-
5247
DEFINE_int32(
5348
testset_idx,
5449
0,
@@ -198,22 +193,18 @@ int main(int argc, char** argv) {
198193
MemoryAllocator bundled_input_allocator{
199194
MemoryAllocator(kBundledAllocatorPoolSize, bundled_allocator_pool)};
200195
exec_aten::ArrayRef<void*> inputs;
201-
if (FLAGS_bundled_program) {
202-
// Use the inputs embedded in the bundled program.
203-
status = torch::executor::util::LoadBundledInput(
204-
*method,
205-
file_data->data(),
206-
&bundled_input_allocator,
207-
0, // Using the 0th indexed program
208-
FLAGS_testset_idx);
209-
ET_CHECK_MSG(
210-
status == Error::Ok,
211-
"LoadBundledInput failed with status 0x%" PRIx32,
212-
status);
213-
} else {
214-
// Use ones-initialized inputs.
215-
inputs = torch::executor::util::PrepareInputTensors(*method);
216-
}
196+
// Use the inputs embedded in the bundled program.
197+
status = torch::executor::util::LoadBundledInput(
198+
*method,
199+
file_data->data(),
200+
&bundled_input_allocator,
201+
0, // Using the 0th indexed program
202+
FLAGS_testset_idx);
203+
ET_CHECK_MSG(
204+
status == Error::Ok,
205+
"LoadBundledInput failed with status 0x%" PRIx32,
206+
status);
207+
217208
ET_LOG(Info, "Inputs prepared.");
218209

219210
// Run the model.
@@ -250,23 +241,20 @@ int main(int argc, char** argv) {
250241
}
251242

252243
// Handle the outputs.
253-
if (FLAGS_bundled_program) {
254-
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
255-
*method,
256-
file_data->data(),
257-
&bundled_input_allocator,
258-
0,
259-
FLAGS_testset_idx,
260-
1e-5, // rtol
261-
1e-8 // atol
262-
);
263-
ET_CHECK_MSG(
264-
status == Error::Ok,
265-
"Bundle verification failed with status 0x%" PRIx32,
266-
status);
267-
ET_LOG(Info, "Model verified successfully.");
268-
} else {
269-
torch::executor::util::FreeInputs(inputs);
270-
}
244+
status = torch::executor::util::VerifyResultWithBundledExpectedOutput(
245+
*method,
246+
file_data->data(),
247+
&bundled_input_allocator,
248+
0,
249+
FLAGS_testset_idx,
250+
1e-5, // rtol
251+
1e-8 // atol
252+
);
253+
ET_CHECK_MSG(
254+
status == Error::Ok,
255+
"Bundle verification failed with status 0x%" PRIx32,
256+
status);
257+
ET_LOG(Info, "Model verified successfully.");
258+
271259
return 0;
272260
}

0 commit comments

Comments
 (0)