1 /* Copyright 2019 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 #ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_UTILS_H_ 16 #define TENSORFLOW_LITE_DELEGATES_HEXAGON_UTILS_H_ 17 18 #include "tensorflow/lite/c/common.h" 19 20 namespace tflite { 21 22 // Interpretes data from 'dims' as a 4D shape {batch, height, width, depth} and 23 // populates the corresponding values. If dims->size < 4, the shape is prefixed 24 // with 1s. 25 // For example, dims {2, 3} is interpreted as: {1, 1, 2, 3}. 26 // Returns kTfLiteError if dims->size > 4, kTfLiteOk otherwise. 27 TfLiteStatus Get4DShape(unsigned int* batch_size, unsigned int* height_size, 28 unsigned int* width_size, unsigned int* depth_size, 29 TfLiteIntArray* dims); 30 31 // Returns true if provided node is supported by Hexagon NNLib in the current 32 // context. 33 bool IsNodeSupportedByHexagon(const TfLiteRegistration* registration, 34 const TfLiteNode* node, TfLiteContext* context); 35 36 } // namespace tflite 37 38 #endif // TENSORFLOW_LITE_DELEGATES_HEXAGON_UTILS_H_ 39