Skip to content

Commit c4ecb5a

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 1d0d0f8 commit c4ecb5a

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,11 +23,18 @@ 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-
Result<TensorInfo> tensor_meta = method_meta.input_tensor_meta(i);
27-
if (!tensor_meta.ok()) {
26+
auto tag = method_meta.input_tag(i);
27+
if (!tag.ok()) {
28+
return tag.error();
29+
}
30+
if (tag.get() != Tag::Tensor) {
2831
ET_LOG(Info, "Skipping non-tensor input %zu", i);
2932
continue;
3033
}
34+
Result<TensorInfo> tensor_meta = method_meta.input_tensor_meta(i);
35+
if (!tensor_meta.ok()) {
36+
return tensor_meta.error();
37+
}
3138
// This input is a tensor. Allocate a buffer for it.
3239
void* data_ptr = malloc(tensor_meta->nbytes());
3340
inputs[num_allocated++] = data_ptr;

0 commit comments

Comments
 (0)