@@ -34,7 +34,8 @@ namespace {
34
34
#define kMaxDim 16
35
35
36
36
// Create an aten tensor with same content using bundled tensor
37
- at::Tensor tensor_like (executorch_flatbuffer::BundledTensor* bundled_tensor) {
37
+ at::Tensor tensor_like (
38
+ bundled_program_flatbuffer::BundledTensor* bundled_tensor) {
38
39
ET_CHECK (bundled_tensor->sizes ()->size () <= kMaxDim );
39
40
int64_t ret_t_sizes[kMaxDim ];
40
41
@@ -55,7 +56,7 @@ at::Tensor tensor_like(executorch_flatbuffer::BundledTensor* bundled_tensor) {
55
56
#else // !USE_ATEN_LIB
56
57
// Create a tensorimpl with same content using bundled tensor
57
58
TensorImpl impl_like (
58
- executorch_flatbuffer ::BundledTensor* bundled_tensor,
59
+ bundled_program_flatbuffer ::BundledTensor* bundled_tensor,
59
60
MemoryAllocator* runtime_allocator) {
60
61
ScalarType scalar_type =
61
62
static_cast <ScalarType>(bundled_tensor->scalar_type ());
@@ -166,8 +167,8 @@ bool tensors_are_close(
166
167
}
167
168
}
168
169
169
- Result<executorch_flatbuffer ::BundledExecutionPlanTest*> get_method_test (
170
- const executorch_flatbuffer ::BundledProgram* bundled_program,
170
+ Result<bundled_program_flatbuffer ::BundledExecutionPlanTest*> get_method_test (
171
+ const bundled_program_flatbuffer ::BundledProgram* bundled_program,
171
172
const char * method_name) {
172
173
auto method_tests = bundled_program->execution_plan_tests ();
173
174
for (size_t i = 0 ; i < method_tests->size (); i++) {
@@ -190,13 +191,13 @@ __ET_NODISCARD Error LoadBundledInput(
190
191
const char * method_name,
191
192
size_t testset_idx) {
192
193
ET_CHECK_OR_RETURN_ERROR (
193
- executorch_flatbuffer ::BundledProgramBufferHasIdentifier (
194
+ bundled_program_flatbuffer ::BundledProgramBufferHasIdentifier (
194
195
bundled_program_ptr),
195
196
NotSupported,
196
197
" The input buffer should be a bundled program." );
197
198
198
199
auto method_test = get_method_test (
199
- executorch_flatbuffer ::GetBundledProgram (bundled_program_ptr),
200
+ bundled_program_flatbuffer ::GetBundledProgram (bundled_program_ptr),
200
201
method_name);
201
202
202
203
if (!method_test.ok ()) {
@@ -217,9 +218,9 @@ __ET_NODISCARD Error LoadBundledInput(
217
218
218
219
// Set e_input with bundled_input based on different types.
219
220
switch (bundled_input->val_type ()) {
220
- case executorch_flatbuffer ::BundledValueUnion::BundledTensor: {
221
+ case bundled_program_flatbuffer ::BundledValueUnion::BundledTensor: {
221
222
auto bundled_input_tensor =
222
- static_cast <executorch_flatbuffer ::BundledTensor*>(
223
+ static_cast <bundled_program_flatbuffer ::BundledTensor*>(
223
224
bundled_input->mutable_val ());
224
225
225
226
#ifdef USE_ATEN_LIB
@@ -238,19 +239,19 @@ __ET_NODISCARD Error LoadBundledInput(
238
239
status = method.set_input (e_input, input_idx);
239
240
break ;
240
241
}
241
- case executorch_flatbuffer ::BundledValueUnion::BundledInt: {
242
+ case bundled_program_flatbuffer ::BundledValueUnion::BundledInt: {
242
243
auto bundled_input_int = bundled_input->val_as_BundledInt ();
243
244
e_input = EValue (bundled_input_int->int_val ());
244
245
status = method.set_input (e_input, input_idx);
245
246
break ;
246
247
}
247
- case executorch_flatbuffer ::BundledValueUnion::BundledDouble: {
248
+ case bundled_program_flatbuffer ::BundledValueUnion::BundledDouble: {
248
249
auto bundled_input_int = bundled_input->val_as_BundledDouble ();
249
250
e_input = EValue (bundled_input_int->double_val ());
250
251
status = method.set_input (e_input, input_idx);
251
252
break ;
252
253
}
253
- case executorch_flatbuffer ::BundledValueUnion::BundledBool: {
254
+ case bundled_program_flatbuffer ::BundledValueUnion::BundledBool: {
254
255
auto bundled_input_int = bundled_input->val_as_BundledBool ();
255
256
e_input = EValue (bundled_input_int->bool_val ());
256
257
status = method.set_input (e_input, input_idx);
@@ -285,13 +286,13 @@ __ET_NODISCARD Error VerifyResultWithBundledExpectedOutput(
285
286
double rtol,
286
287
double atol) {
287
288
ET_CHECK_OR_RETURN_ERROR (
288
- executorch_flatbuffer ::BundledProgramBufferHasIdentifier (
289
+ bundled_program_flatbuffer ::BundledProgramBufferHasIdentifier (
289
290
bundled_program_ptr),
290
291
NotSupported,
291
292
" The input buffer should be a bundled program." );
292
293
293
294
auto method_test = get_method_test (
294
- executorch_flatbuffer ::GetBundledProgram (bundled_program_ptr),
295
+ bundled_program_flatbuffer ::GetBundledProgram (bundled_program_ptr),
295
296
method_name);
296
297
297
298
if (!method_test.ok ()) {
@@ -307,9 +308,9 @@ __ET_NODISCARD Error VerifyResultWithBundledExpectedOutput(
307
308
bundled_expected_outputs->GetMutableObject (output_idx);
308
309
auto method_output = method.get_output (output_idx);
309
310
switch (bundled_expected_output->val_type ()) {
310
- case executorch_flatbuffer ::BundledValueUnion::BundledTensor: {
311
+ case bundled_program_flatbuffer ::BundledValueUnion::BundledTensor: {
311
312
auto bundled_expected_output_tensor =
312
- static_cast <executorch_flatbuffer ::BundledTensor*>(
313
+ static_cast <bundled_program_flatbuffer ::BundledTensor*>(
313
314
bundled_expected_output->mutable_val ());
314
315
const auto method_output_tensor = method_output.toTensor ();
315
316
@@ -348,9 +349,10 @@ __ET_NODISCARD Error GetProgramData(
348
349
if (executorch_flatbuffer::ProgramBufferHasIdentifier (file_data)) {
349
350
*out_program_data = file_data;
350
351
*out_program_data_len = file_data_len;
351
- } else if (executorch_flatbuffer ::BundledProgramBufferHasIdentifier (
352
+ } else if (bundled_program_flatbuffer ::BundledProgramBufferHasIdentifier (
352
353
file_data)) {
353
- auto program_bundled = executorch_flatbuffer::GetBundledProgram (file_data);
354
+ auto program_bundled =
355
+ bundled_program_flatbuffer::GetBundledProgram (file_data);
354
356
*out_program_data = program_bundled->program ()->data ();
355
357
*out_program_data_len = program_bundled->program ()->size ();
356
358
} else {
0 commit comments