Daniel Konegen / MNIST_example

Dependencies:   mbed-os

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers compatibility.h Source File

compatibility.h

00001 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
00002 
00003 Licensed under the Apache License, Version 2.0 (the "License");
00004 you may not use this file except in compliance with the License.
00005 You may obtain a copy of the License at
00006 
00007     http://www.apache.org/licenses/LICENSE-2.0
00008 
00009 Unless required by applicable law or agreed to in writing, software
00010 distributed under the License is distributed on an "AS IS" BASIS,
00011 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 See the License for the specific language governing permissions and
00013 limitations under the License.
00014 ==============================================================================*/
00015 #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
00016 #define TENSORFLOW_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
00017 
00018 #include <cstdint>
00019 
00020 #include "tensorflow/lite/kernels/op_macros.h"
00021 
00022 #ifndef TFLITE_DCHECK
00023 #define TFLITE_DCHECK(condition) (condition) ? (void)0 : TFLITE_ASSERT_FALSE
00024 #endif
00025 
00026 #ifndef TFLITE_DCHECK_EQ
00027 #define TFLITE_DCHECK_EQ(x, y) ((x) == (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00028 #endif
00029 
00030 #ifndef TFLITE_DCHECK_NE
00031 #define TFLITE_DCHECK_NE(x, y) ((x) != (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00032 #endif
00033 
00034 #ifndef TFLITE_DCHECK_GE
00035 #define TFLITE_DCHECK_GE(x, y) ((x) >= (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00036 #endif
00037 
00038 #ifndef TFLITE_DCHECK_GT
00039 #define TFLITE_DCHECK_GT(x, y) ((x) > (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00040 #endif
00041 
00042 #ifndef TFLITE_DCHECK_LE
00043 #define TFLITE_DCHECK_LE(x, y) ((x) <= (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00044 #endif
00045 
00046 #ifndef TFLITE_DCHECK_LT
00047 #define TFLITE_DCHECK_LT(x, y) ((x) < (y)) ? (void)0 : TFLITE_ASSERT_FALSE
00048 #endif
00049 
00050 // TODO(ahentz): Clean up: We should stick to the DCHECK versions.
00051 #ifndef TFLITE_CHECK
00052 #define TFLITE_CHECK(condition) (condition) ? (void)0 : TFLITE_ABORT
00053 #endif
00054 
00055 #ifndef TFLITE_CHECK_EQ
00056 #define TFLITE_CHECK_EQ(x, y) ((x) == (y)) ? (void)0 : TFLITE_ABORT
00057 #endif
00058 
00059 #ifndef TFLITE_CHECK_NE
00060 #define TFLITE_CHECK_NE(x, y) ((x) != (y)) ? (void)0 : TFLITE_ABORT
00061 #endif
00062 
00063 #ifndef TFLITE_CHECK_GE
00064 #define TFLITE_CHECK_GE(x, y) ((x) >= (y)) ? (void)0 : TFLITE_ABORT
00065 #endif
00066 
00067 #ifndef TFLITE_CHECK_GT
00068 #define TFLITE_CHECK_GT(x, y) ((x) > (y)) ? (void)0 : TFLITE_ABORT
00069 #endif
00070 
00071 #ifndef TFLITE_CHECK_LE
00072 #define TFLITE_CHECK_LE(x, y) ((x) <= (y)) ? (void)0 : TFLITE_ABORT
00073 #endif
00074 
00075 #ifndef TFLITE_CHECK_LT
00076 #define TFLITE_CHECK_LT(x, y) ((x) < (y)) ? (void)0 : TFLITE_ABORT
00077 #endif
00078 
00079 // TODO(ahentz): Clean up.
00080 using int8 = std::int8_t;
00081 using uint8 = std::uint8_t;
00082 using int16 = std::int16_t;
00083 using uint16 = std::uint16_t;
00084 using int32 = std::int32_t;
00085 using uint32 = std::uint32_t;
00086 
00087 // TFLITE_DEPRECATED()
00088 //
00089 // Duplicated from absl/base/macros.h to avoid pulling in that library.
00090 // Marks a deprecated class, struct, enum, function, method and variable
00091 // declarations. The macro argument is used as a custom diagnostic message (e.g.
00092 // suggestion of a better alternative).
00093 //
00094 // Example:
00095 //
00096 //   class TFLITE_DEPRECATED("Use Bar instead") Foo {...};
00097 //   TFLITE_DEPRECATED("Use Baz instead") void Bar() {...}
00098 //
00099 // Every usage of a deprecated entity will trigger a warning when compiled with
00100 // clang's `-Wdeprecated-declarations` option. This option is turned off by
00101 // default, but the warnings will be reported by clang-tidy.
00102 #if defined(__clang__) && __cplusplus >= 201103L
00103 #define TFLITE_DEPRECATED(message) __attribute__((deprecated(message)))
00104 #endif
00105 
00106 #ifndef TFLITE_DEPRECATED
00107 #define TFLITE_DEPRECATED(message)
00108 #endif
00109 
00110 #endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_