| 70 | |
| 71 | template <typename FromT> |
| 72 | TfLiteStatus copyToTensor(const FromT* in, TfLiteTensor* out, |
| 73 | int num_elements) { |
| 74 | switch (out->type) { |
| 75 | case kTfLiteInt64: |
| 76 | copyCast(in, out->data.i64, num_elements); |
| 77 | break; |
| 78 | case kTfLiteInt32: |
| 79 | copyCast(in, out->data.i32, num_elements); |
| 80 | break; |
| 81 | case kTfLiteUInt8: |
| 82 | copyCast(in, out->data.uint8, num_elements); |
| 83 | break; |
| 84 | case kTfLiteFloat32: |
| 85 | copyCast(in, out->data.f, num_elements); |
| 86 | break; |
| 87 | case kTfLiteBool: |
| 88 | copyCast(in, out->data.b, num_elements); |
| 89 | break; |
| 90 | case kTfLiteComplex64: |
| 91 | copyCast(in, reinterpret_cast<std::complex<float>*>(out->data.c64), |
| 92 | num_elements); |
| 93 | break; |
| 94 | default: |
| 95 | // Unsupported type. |
| 96 | return kTfLiteError; |
| 97 | } |
| 98 | return kTfLiteOk; |
| 99 | } |
| 100 | |
| 101 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 102 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); |