| 99 | } |
| 100 | |
| 101 | TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { |
| 102 | const TfLiteTensor* input = GetInput(context, node, kInputTensor); |
| 103 | TfLiteTensor* output = GetOutput(context, node, kOutputTensor); |
| 104 | const int num_elements = NumElements(input); |
| 105 | TF_LITE_ENSURE_EQ(context, num_elements, NumElements(output)); |
| 106 | switch (input->type) { |
| 107 | case kTfLiteInt64: |
| 108 | return copyToTensor(input->data.i64, output, num_elements); |
| 109 | case kTfLiteInt32: |
| 110 | return copyToTensor(input->data.i32, output, num_elements); |
| 111 | case kTfLiteUInt8: |
| 112 | return copyToTensor(input->data.uint8, output, num_elements); |
| 113 | case kTfLiteFloat32: |
| 114 | return copyToTensor(input->data.f, output, num_elements); |
| 115 | case kTfLiteBool: |
| 116 | return copyToTensor(input->data.b, output, num_elements); |
| 117 | case kTfLiteComplex64: |
| 118 | return copyToTensor( |
| 119 | reinterpret_cast<std::complex<float>*>(input->data.c64), output, |
| 120 | num_elements); |
| 121 | default: |
| 122 | // Unsupported type. |
| 123 | return kTfLiteError; |
| 124 | } |
| 125 | return kTfLiteOk; |
| 126 | } |
| 127 | } // namespace cast |
| 128 | |
| 129 | TfLiteRegistration* Register_CAST() { |
nothing calls this directly
no test coverage detected