Skip to content

Commit bb5e19d

Browse files
tarun292facebook-github-bot
authored andcommitted
Add support for const inputs in runner_util (#1810)
Summary: These are all valid input types now in an Executorch program. Differential Revision: D53335087
1 parent 31ba154 commit bb5e19d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

extension/runner_util/inputs.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ 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+
if (tag.get() != Tag::Tensor) {
31+
ET_LOG(Debug, "Skipping non-tensor input %zu", i);
32+
continue;
33+
}
2634
Result<TensorInfo> tensor_meta = method_meta.input_tensor_meta(i);
2735
if (!tensor_meta.ok()) {
28-
ET_LOG(Info, "Skipping non-tensor input %zu", i);
29-
continue;
36+
return tensor_meta.error();
3037
}
3138
// This input is a tensor. Allocate a buffer for it.
3239
void* data_ptr = malloc(tensor_meta->nbytes());

0 commit comments

Comments
 (0)