Home | History | Annotate | Download | only in internal
      1 /* Copyright 2017 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_CONTRIB_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
     16 #define TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
     17 
     18 #include <cassert>
     19 #include <cstdint>
     20 #include <cstdlib>
     21 
     22 #ifndef TFLITE_DCHECK
     23 #define TFLITE_DCHECK(condition) (condition) ? (void)0 : assert(false)
     24 #endif
     25 
     26 #ifndef TFLITE_DCHECK_EQ
     27 #define TFLITE_DCHECK_EQ(x, y) ((x) == (y)) ? (void)0 : assert(false)
     28 #endif
     29 
     30 #ifndef TFLITE_DCHECK_NE
     31 #define TFLITE_DCHECK_NE(x, y) ((x) != (y)) ? (void)0 : assert(false)
     32 #endif
     33 
     34 #ifndef TFLITE_DCHECK_GE
     35 #define TFLITE_DCHECK_GE(x, y) ((x) >= (y)) ? (void)0 : assert(false)
     36 #endif
     37 
     38 #ifndef TFLITE_DCHECK_GT
     39 #define TFLITE_DCHECK_GT(x, y) ((x) > (y)) ? (void)0 : assert(false)
     40 #endif
     41 
     42 #ifndef TFLITE_DCHECK_LE
     43 #define TFLITE_DCHECK_LE(x, y) ((x) <= (y)) ? (void)0 : assert(false)
     44 #endif
     45 
     46 #ifndef TFLITE_DCHECK_LT
     47 #define TFLITE_DCHECK_LT(x, y) ((x) < (y)) ? (void)0 : assert(false)
     48 #endif
     49 
     50 // TODO(ahentz): Clean up: We should stick to the DCHECK versions.
     51 #ifndef TFLITE_CHECK
     52 #define TFLITE_CHECK(condition) (condition) ? (void)0 : abort()
     53 #endif
     54 
     55 #ifndef TFLITE_CHECK_EQ
     56 #define TFLITE_CHECK_EQ(x, y) ((x) == (y)) ? (void)0 : abort()
     57 #endif
     58 
     59 #ifndef TFLITE_CHECK_NE
     60 #define TFLITE_CHECK_NE(x, y) ((x) != (y)) ? (void)0 : abort()
     61 #endif
     62 
     63 #ifndef TFLITE_CHECK_GE
     64 #define TFLITE_CHECK_GE(x, y) ((x) >= (y)) ? (void)0 : abort()
     65 #endif
     66 
     67 #ifndef TFLITE_CHECK_GT
     68 #define TFLITE_CHECK_GT(x, y) ((x) > (y)) ? (void)0 : abort()
     69 #endif
     70 
     71 #ifndef TFLITE_CHECK_LE
     72 #define TFLITE_CHECK_LE(x, y) ((x) <= (y)) ? (void)0 : abort()
     73 #endif
     74 
     75 #ifndef TFLITE_CHECK_LT
     76 #define TFLITE_CHECK_LT(x, y) ((x) < (y)) ? (void)0 : abort()
     77 #endif
     78 
     79 // TODO(ahentz): Clean up.
     80 using uint8 = std::uint8_t;
     81 using int16 = std::int16_t;
     82 using uint16 = std::uint16_t;
     83 using int32 = std::int32_t;
     84 using uint32 = std::uint32_t;
     85 
     86 #endif  // TENSORFLOW_CONTRIB_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
     87