| 69 | // to `dst_tensor_indices` in `dst_subgraph`. |
| 70 | template <typename SrcVector, typename DstVector> |
| 71 | TfLiteStatus CopyTensorsData(TfLiteContext* context, Subgraph* src_subgraph, |
| 72 | const SrcVector& src_tensor_indices, |
| 73 | Subgraph* dst_subgraph, |
| 74 | const DstVector& dst_tensor_indices) { |
| 75 | TF_LITE_ENSURE_EQ(context, src_tensor_indices.size(), |
| 76 | dst_tensor_indices.size()); |
| 77 | for (int i = 0; i < src_tensor_indices.size(); ++i) { |
| 78 | const TfLiteTensor* src_tensor = |
| 79 | src_subgraph->tensor(src_tensor_indices[i]); |
| 80 | TfLiteTensor* dst_tensor = dst_subgraph->tensor(dst_tensor_indices[i]); |
| 81 | TF_LITE_ENSURE_EQ(context, src_tensor->bytes, dst_tensor->bytes); |
| 82 | memcpy(dst_tensor->data.raw, src_tensor->data.raw, src_tensor->bytes); |
| 83 | } |
| 84 | return kTfLiteOk; |
| 85 | } |
| 86 | |
| 87 | TfLiteStatus CheckCondOutput(TfLiteContext* context, |
| 88 | const TfLiteTensor* cond_output) { |