Исходный код СУБД 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include "core/framework/execution_provider.h"
#include "core/framework/kernel_def_builder.h"
#include "core/framework/ort_value.h"
#include "core/framework/op_node_proto_helper.h"
#include "core/graph/graph_viewer.h"
#include <gsl/gsl>
 
namespace onnxruntime {
 
class DataTransferManager;
class FuncManager;
class OrtValueNameIdxMap;
struct AllocPlanPerValue;
 
// A very light-weight class, which works as an aggregated
// view of all data needed for constructing a Kernel instance.
// NOTE: it does not own/hold any objects.
class OpKernelInfo : public OpNodeProtoHelper<ProtoHelperNodeContext> {
 public:
  explicit OpKernelInfo(const onnxruntime::Node& node,
                        const KernelDef& kernel_def,
                        const IExecutionProvider& execution_provider,
                        const std::unordered_map<int, OrtValue>& constant_initialized_tensors,
                        const OrtValueNameIdxMap& mlvalue_name_idx_map,
                        const DataTransferManager& data_transfer_mgr,
                        const AllocatorMap& allocators,
                        const ConfigOptions& config_options);
 
  OpKernelInfo(const OpKernelInfo& other);
 
  const OrtDevice GetDevice(OrtMemType mem_type) const;
 
  AllocatorPtr GetAllocator(OrtMemType mem_type) const;
 
  const KernelDef& GetKernelDef() const;
 
  const IExecutionProvider* GetExecutionProvider() const noexcept;
 
  const DataTransferManager& GetDataTransferManager() const noexcept;
 
  const onnxruntime::Node& node() const noexcept;
 
  bool TryGetConstantInput(int input_index, const Tensor** constant_input_value) const;
 
  bool TryGetConstantInput(int input_index, const OrtValue** constant_input_value) const;
 
  const AllocatorMap& GetAllocators() const { return allocators_; }
 
  const ConfigOptions& GetConfigOptions() const { return config_options_; }
 
 private:
  ORT_DISALLOW_MOVE(OpKernelInfo);
  ORT_DISALLOW_ASSIGNMENT(OpKernelInfo);
 
  const onnxruntime::Node& node_;
  const KernelDef& kernel_def_;
  // For non cpu/cuda case, this pointer should be set so that function kernel
  // will delegate kernel compute call to <execution_provider> compute call.
  gsl::not_null<const ::onnxruntime::IExecutionProvider*> execution_provider_;
  const std::unordered_map<int, OrtValue>& constant_initialized_tensors_;
  const OrtValueNameIdxMap& ort_value_name_idx_map_;
  const DataTransferManager& data_transfer_mgr_;
  ProtoHelperNodeContext proto_helper_context_;
  const AllocatorMap& allocators_;
  const ConfigOptions& config_options_;
};
 
}  // namespace onnxruntime