// Copyright 2021 The MediaPipe Authors. // // 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 MEDIAPIPE_FRAMEWORK_FORMATS_TENSOR_INTERNAL_H_ #define MEDIAPIPE_FRAMEWORK_FORMATS_TENSOR_INTERNAL_H_ #include <cstdint> #include <type_traits> namespace mediapipe { // Generates unique view id at compile-time using FILE and LINE. #define TENSOR_UNIQUE_VIEW_TYPE_ID() … // Generates unique view id at compile-time using FILE and LINE and Type of the // template view's argument. #define TENSOR_UNIQUE_VIEW_TYPE_ID_T(T) … namespace tensor_internal { #define TENSOR_INT_TO_STRING2(x) … #define TENSOR_INT_TO_STRING(x) … // Compile-time hash function // https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function constexpr uint64_t kFnvPrime = …; constexpr uint64_t kFnvOffsetBias = …; constexpr uint64_t FnvHash64(uint64_t value1, uint64_t value2) { … } constexpr uint64_t FnvHash64(const char* str, uint64_t hash = kFnvOffsetBias) { … } template <typename... Ts> struct TypeList { … }; template <typename, typename> struct TypeInList { … }; TypeInList<T, TypeList<T, Ts...>>; TypeInList<T, TypeList<TOther, Ts...>>; } // namespace tensor_internal } // namespace mediapipe #endif // MEDIAPIPE_FRAMEWORK_FORMATS_TENSOR_INTERNAL_H_