1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_UNIMPLEMENTED_OPERATION_PARSER_H_ 17 #define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_UNIMPLEMENTED_OPERATION_PARSER_H_ 18 19 #include <string> 20 21 #include "absl/memory/memory.h" 22 #include "absl/strings/string_view.h" 23 #include "absl/types/any.h" 24 #include "tensorflow/lite/delegates/gpu/common/operation_parser.h" 25 #include "tensorflow/lite/delegates/gpu/common/status.h" 26 27 namespace tflite { 28 namespace gpu { 29 30 class UnimplementedOperationParser : public TFLiteOperationParser { 31 public: UnimplementedOperationParser(absl::string_view op_name)32 explicit UnimplementedOperationParser(absl::string_view op_name) 33 : op_name_(op_name) {} 34 IsSupported(const TfLiteContext * context,const TfLiteNode * tflite_node,const TfLiteRegistration * registration)35 absl::Status IsSupported(const TfLiteContext* context, 36 const TfLiteNode* tflite_node, 37 const TfLiteRegistration* registration) final { 38 return absl::UnimplementedError(op_name_); 39 } 40 Parse(const TfLiteNode * tflite_node,const TfLiteRegistration * registration,GraphFloat32 * graph,ObjectReader * reader)41 absl::Status Parse(const TfLiteNode* tflite_node, 42 const TfLiteRegistration* registration, 43 GraphFloat32* graph, ObjectReader* reader) final { 44 return absl::UnimplementedError(op_name_); 45 } 46 47 private: 48 std::string op_name_; 49 }; 50 51 } // namespace gpu 52 } // namespace tflite 53 54 #endif // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_UNIMPLEMENTED_OPERATION_PARSER_H_ 55