Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include "core/graph/onnx_protobuf.h"
#include "core/common/status.h"
#include "core/graph/constants.h"
 
#include <functional>
#include <unordered_map>
 
namespace onnxruntime {
using AttrType = ONNX_NAMESPACE::AttributeProto_AttributeType;
using NodeAttributes = std::unordered_map<std::string, ONNX_NAMESPACE::AttributeProto>;
 
// This string array should exactly match the AttrType defined above.
/*
AttributeProto_AttributeType_UNDEFINED = 0,
AttributeProto_AttributeType_FLOAT = 1,
AttributeProto_AttributeType_INT = 2,
AttributeProto_AttributeType_STRING = 3,
AttributeProto_AttributeType_TENSOR = 4,
AttributeProto_AttributeType_GRAPH = 5,
AttributeProto_AttributeType_FLOATS = 6,
AttributeProto_AttributeType_INTS = 7,
AttributeProto_AttributeType_STRINGS = 8,
AttributeProto_AttributeType_TENSORS = 9,
AttributeProto_AttributeType_GRAPHS = 10,
AttributeProto_AttributeType_SPARSE_TENSOR = 22,
AttributeProto_AttributeType_SPARSE_TENSORS = 23,
*/
static constexpr const char* kAttrTypeStrings[] = {
    "UNDEFINED",
    "FLOAT",
    "INT",
    "STRING",
    "TENSOR",
    "GRAPH",
    "FLOATS",
    "INTS",
    "STRINGS",
    "TENSORS",
    "GRAPHS"};
 
class TypeUtils {
 public:
  // Get attribute type given attribute proto data.
  static ::onnxruntime::common::Status GetType(const ONNX_NAMESPACE::AttributeProto& attr, AttrType& type);
  static bool IsValidAttribute(const ONNX_NAMESPACE::AttributeProto& attribute);
};
}  // namespace onnxruntime