Warning, file /include/onnx/defs/data_type_utils.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005 #ifndef ONNX_DATA_TYPE_UTILS_H
0006 #define ONNX_DATA_TYPE_UTILS_H
0007
0008 #include <mutex>
0009 #include <string>
0010 #include <unordered_map>
0011 #include <unordered_set>
0012
0013 #include "onnx/common/common.h"
0014 #include "onnx/onnx_pb.h"
0015
0016 namespace ONNX_NAMESPACE {
0017
0018 using DataType = const std::string*;
0019
0020 namespace Utils {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class DataTypeUtils final {
0039 public:
0040
0041
0042 static DataType ToType(const std::string& type_str);
0043
0044
0045
0046 static DataType ToType(const TypeProto& type_proto);
0047
0048
0049
0050 static const TypeProto& ToTypeProto(const DataType& data_type);
0051 static std::string ToDataTypeString(int32_t tensor_data_type);
0052
0053 private:
0054 static void FromString(const std::string& type_str, TypeProto& type_proto);
0055
0056 static void FromDataTypeString(const std::string& type_str, int32_t& tensor_data_type);
0057
0058 static std::string ToString(const TypeProto& type_proto, const std::string& left = "", const std::string& right = "");
0059
0060
0061
0062
0063 static bool IsValidDataTypeString(const std::string& type_str);
0064
0065 static std::unordered_map<std::string, TypeProto>& GetTypeStrToProtoMap();
0066
0067
0068 static std::mutex& GetTypeStrLock();
0069 };
0070 }
0071 }
0072
0073 #endif