Provide a range iterable wrapper for TfLiteIntArray* (C lists that TfLite C api uses. Can't use the google array_view, since we can't depend on even absl for embedded device reasons. TODO(aselle): Move this into central utilities.
| 25 | // absl for embedded device reasons. |
| 26 | // TODO(aselle): Move this into central utilities. |
| 27 | class TfLiteIntArrayView { |
| 28 | public: |
| 29 | // Construct a view of a TfLiteIntArray*. Note, `int_array` should be non-null |
| 30 | // and this view does not take ownership of it. |
| 31 | explicit TfLiteIntArrayView(const TfLiteIntArray* int_array) |
| 32 | : int_array_(int_array) {} |
| 33 | |
| 34 | typedef const int* const_iterator; |
| 35 | const_iterator begin() const { return int_array_->data; } |
| 36 | const_iterator end() const { return &int_array_->data[int_array_->size]; } |
| 37 | |
| 38 | TfLiteIntArrayView(const TfLiteIntArrayView&) = default; |
| 39 | TfLiteIntArrayView& operator=(const TfLiteIntArrayView& rhs) = default; |
| 40 | |
| 41 | private: |
| 42 | const TfLiteIntArray* int_array_; |
| 43 | }; |
| 44 | |
| 45 | // Helper class that actually performs partitioning by node sub set. |
| 46 | // Outputs to a provided `NodeSubset` structure. |
no outgoing calls
no test coverage detected