We have two arrays and we need to check that elements from one array don't show up in the other. We could sort both arrays and then iterate with two pointers from start to finish always increasing the smaller one but since these arrays are usually short (<25 elements for inputs, usually <3 for outputs), this might be slower than the naive approach (if arrays have size n and m, with n >> m ~ O(1),
| 476 | // |
| 477 | // If it turns out that this is an issue, we can switch to the other algorithm. |
| 478 | TfLiteStatus Subgraph::CheckInputAndOutputForOverlap(const int* input_indices, |
| 479 | int num_inputs, |
| 480 | const int* output_indices, |
| 481 | int num_outputs) { |
| 482 | for (int i = 0; i < num_inputs; i++) { |
| 483 | for (int j = 0; j < num_outputs; j++) { |
| 484 | if (input_indices[i] == output_indices[j]) { |
| 485 | ReportError("Tensor %d is both input %d and output %d\n", |
| 486 | input_indices[i], i, j); |
| 487 | consistent_ = false; |
| 488 | return kTfLiteError; |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | return kTfLiteOk; |
| 493 | } |
| 494 | |
| 495 | TfLiteStatus Subgraph::BytesRequired(TfLiteType type, const int* dims, |
| 496 | size_t dims_size, size_t* bytes) { |
nothing calls this directly
no test coverage detected