/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_ #define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_ #include <algorithm> #include "tensorflow/lite/kernels/internal/types.h" namespace tflite { namespace reference_ops { // Consolidates dimensions in broadcast inputs, checks for five-fold pattern. // // For example, if sequence of dimensions of one input is // ..., 1, 3, 1, 7, 9, 5,... and the other is ..., 2, 3, 1, 7, 1, 1, ... // we can consolidate these as // ..., 1, 3*7, 9*5, ... and 2, 3*7, 1. // // The category is updated in the less-frequent case of shapes that are // not suited to a fivefold-loop broadcast. // // Falls back to generic pattern when it does not know how to process properly. // // Returns true iff there is some sort of broadcast, which includes five-fold // patterns and falling back to generic broadcast. inline bool ProcessBroadcastShapes(const RuntimeShape& shape0, const RuntimeShape& shape1, tflite::ArithmeticParams* params) { … } } // namespace reference_ops } // namespace tflite #endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_