diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-04-04 07:45:31 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-04 07:50:20 -0700 |
commit | 3fbec92fa4997fc834807b57b229fa9ada179f6c (patch) | |
tree | 34a7c15af0428e5ecf2ee2deb16e7c26b3d4320b /tensorflow/contrib/lite/kernels/cast.cc | |
parent | 71b19430e8484b136e0b872f6a543aff8a242587 (diff) |
Turn Cast into a proper builtin operator.
PiperOrigin-RevId: 191590230
Diffstat (limited to 'tensorflow/contrib/lite/kernels/cast.cc')
-rw-r--r-- | tensorflow/contrib/lite/kernels/cast.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tensorflow/contrib/lite/kernels/cast.cc b/tensorflow/contrib/lite/kernels/cast.cc index 19942de7bc..17ef2c572e 100644 --- a/tensorflow/contrib/lite/kernels/cast.cc +++ b/tensorflow/contrib/lite/kernels/cast.cc @@ -34,6 +34,15 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); + + // TODO(ahentz): these two checks would make the new implementation + // incompatible with some existing models, where params is not specified. It + // is OK not to have them because toco would have set input and output types + // to match the parameters. + // auto* params = reinterpret_cast<TfLiteCastParams*>(node->builtin_data); + // TF_LITE_ENSURE_EQ(context, input->type, params->in_data_type); + // TF_LITE_ENSURE_EQ(context, output->type, params->out_data_type); + return context->ResizeTensor(context, output, TfLiteIntArrayCopy(input->dims)); } |