|
15 | 15 | #include "litert/core/model/model_load.h" |
16 | 16 |
|
17 | 17 | #include <algorithm> |
| 18 | +#include <cstddef> |
18 | 19 | #include <cstdint> |
19 | 20 | #include <memory> |
20 | 21 | #include <string> |
|
25 | 26 | #include "absl/strings/string_view.h" // from @com_google_absl |
26 | 27 | #include "litert/c/internal/litert_logging.h" |
27 | 28 | #include "litert/c/litert_common.h" |
28 | | -#include "litert/c/litert_model.h" |
29 | 29 | #include "litert/c/litert_op_code.h" |
30 | 30 | #include "litert/cc/litert_buffer_ref.h" |
31 | 31 | #include "litert/cc/litert_expected.h" |
@@ -90,7 +90,8 @@ class FlatbufferContext { |
90 | 90 | }; |
91 | 91 |
|
92 | 92 | LiteRtStatus UnpackOp(FlatbufferContext& context, LiteRtSubgraphT& parent, |
93 | | - const TflPackedOp& tfl_op, LiteRtOpT& litert_op) { |
| 93 | + const TflPackedOp& tfl_op, LiteRtOpT& litert_op, |
| 94 | + size_t op_index) { |
94 | 95 | // I/O TENSORS |
95 | 96 |
|
96 | 97 | if (tfl_op.intermediates() && tfl_op.intermediates()->size() != 0) { |
@@ -145,6 +146,7 @@ LiteRtStatus UnpackOp(FlatbufferContext& context, LiteRtSubgraphT& parent, |
145 | 146 | // OP CODE |
146 | 147 |
|
147 | 148 | LITERT_RETURN_IF_ERROR(context.SetOpCode(litert_op, tfl_op.opcode_index())); |
| 149 | + litert_op.SetOpIndex(op_index); |
148 | 150 |
|
149 | 151 | return kLiteRtStatusOk; |
150 | 152 | } |
@@ -275,7 +277,7 @@ LiteRtStatus UnpackSubgraph(FlatbufferContext& context, |
275 | 277 | for (auto i = 0; i < num_ops; ++i) { |
276 | 278 | const auto* tfl_op = tfl_subgraph.operators()->Get(i); |
277 | 279 | LITERT_RETURN_IF_ERROR(UnpackOp(context, litert_subgraph, *tfl_op, |
278 | | - litert_subgraph.EmplaceOp())); |
| 280 | + litert_subgraph.EmplaceOp(), i)); |
279 | 281 | } |
280 | 282 |
|
281 | 283 | // Update subgraph I/O. |
|
0 commit comments