Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#if !defined(ORT_EP_API_ADAPTER_HEADER_INCLUDED)
#error "This header should not be included directly. Include ep/adapters.h instead."
#endif
 
namespace onnxruntime {
namespace ep {
namespace adapter {
 
/// <summary>
/// An adapter class partially implementing the interface of `onnxruntime::Node`.
/// </summary>
struct Node {
  explicit Node(const OrtKernelInfo* kernel_info) : kernel_info_{kernel_info} {}
  /** Gets the Node's name. */
  std::string Name() const noexcept {
    return kernel_info_.GetNodeName();
  }
 
  /** Gets the Node's operator type. */
  std::string OpType() const noexcept {
    return kernel_info_.GetOperatorType();
  }
 
  /** Gets the Node's domain. */
  std::string Domain() const {
    return kernel_info_.GetOperatorDomain();
  }
 
  /** Gets the since version of the operator. */
  int SinceVersion() const noexcept {
    return kernel_info_.GetOperatorSinceVersion();
  }
 
  /** Gets the number of inputs. */
  size_t InputCount() const noexcept {
    return kernel_info_.GetInputCount();
  }
 
  /** Gets whether an input exists or is an omitted optional input. */
  bool InputExists(size_t index) const {
    return index < InputCount() && !kernel_info_.GetInputName(index).empty();
  }
 
  /** Gets the number of outputs. */
  size_t OutputCount() const noexcept {
    return kernel_info_.GetOutputCount();
  }
 
  /** Gets whether an output exists or is an omitted optional output. */
  bool OutputExists(size_t index) const {
    // KernelInfo_GetOutputName returns an empty string for omitted optional
    // outputs, which lets adapter consumers mirror NodeArg::Exists() without
    // pulling in full NodeArg metadata.
    return index < OutputCount() && !kernel_info_.GetOutputName(index).empty();
  }
 
 private:
  const Ort::ConstKernelInfo kernel_info_;
};
 
}  // namespace adapter
}  // namespace ep
}  // namespace onnxruntime