HiPipe  0.7.0
C++17 data pipeline with Python bindings.
to_tf_type.hpp
1 /****************************************************************************
2  * hipipe library
3  * Copyright (c) 2017, Cognexa Solutions s.r.o.
4  * Copyright (c) 2018, Iterait a.s.
5  * Author(s) Filip Matzner
6  *
7  * This file is distributed under the MIT License.
8  * See the accompanying file LICENSE.txt for the complete license agreement.
9  ****************************************************************************/
10 
11 #ifndef HIPIPE_TENSORFLOW_UTILITY_TO_TF_TYPE_HPP
12 #define HIPIPE_TENSORFLOW_UTILITY_TO_TF_TYPE_HPP
13 
14 #include "tensorflow/core/framework/tensor.h"
15 
16 namespace hipipe::tensorflow {
17 
18 constexpr auto to_tf_type(bool)
19 {
20  return ::tensorflow::DT_BOOL;
21 }
22 
23 constexpr auto to_tf_type(float)
24 {
25  return ::tensorflow::DT_FLOAT;
26 }
27 
28 constexpr auto to_tf_type(double)
29 {
30  return ::tensorflow::DT_DOUBLE;
31 }
32 
33 constexpr auto to_tf_type(std::int8_t)
34 {
35  return ::tensorflow::DT_INT8;
36 }
37 
38 constexpr auto to_tf_type(std::int16_t)
39 {
40  return ::tensorflow::DT_INT16;
41 }
42 
43 constexpr auto to_tf_type(std::int32_t)
44 {
45  return ::tensorflow::DT_INT32;
46 }
47 
48 constexpr auto to_tf_type(std::int64_t)
49 {
50  return ::tensorflow::DT_INT64;
51 }
52 
53 constexpr auto to_tf_type(std::uint8_t)
54 {
55  return ::tensorflow::DT_UINT8;
56 }
57 
58 constexpr auto to_tf_type(std::uint16_t)
59 {
60  return ::tensorflow::DT_UINT16;
61 }
62 
63 auto to_tf_type(std::string)
64 {
65  return ::tensorflow::DT_STRING;
66 }
67 
68 } // namespace hipipe::tensorflow
69 #endif