Skip to content

Commit 7b6eeb8

Browse files
tarun292facebook-github-bot
authored andcommitted
Add support for const inputs in runner_util
Summary: These are all valid input types now in an Executorch program. Differential Revision: D53335087
1 parent 451ca72 commit 7b6eeb8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

extension/runner_util/inputs.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ Result<BufferCleanup> prepare_input_tensors(Method& method) {
2323
void** inputs = (void**)malloc(num_inputs * sizeof(void*));
2424

2525
for (size_t i = 0; i < num_inputs; i++) {
26+
auto tag = method_meta.input_tag(i);
27+
if (!tag.ok()) {
28+
return tag.error();
29+
}
30+
31+
// Skip valid non-tensor inputs such as ints & floats.
32+
switch (tag.get()) {
33+
case Tag::Int:
34+
case Tag::Double:
35+
case Tag::Bool:
36+
continue;
37+
default:
38+
break;
39+
}
40+
2641
Result<TensorInfo> tensor_meta = method_meta.input_tensor_meta(i);
2742
if (!tensor_meta.ok()) {
2843
ET_LOG(Info, "Skipping non-tensor input %zu", i);

0 commit comments

Comments
 (0)