Исходный код СУБД 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include "core/optimizer/transpose_optimization/optimizer_api.h"
#include "core/optimizer/transpose_optimization/onnx_transpose_optimization.h"
 
namespace onnxruntime {
/// <summary>
/// Get the extended handlers for ORT specific transpose optimization.
/// These include handlers for contrib ops, and where we have an NHWC version of a layout sensitive op.
/// </summary>
/// <returns>HandlerMap</returns>
const onnx_transpose_optimization::HandlerMap& OrtExtendedHandlers();
 
/// <summary>
/// Cost check function for transpose optimizer that takes into account implementation details of the
/// ORT execution provider kernels.
/// </summary>
/// <param name="graph">The graph being optimized</param>
/// <param name="node">The node we're considering pushing a Transpose through</param>
/// <param name="perm">The perm value of the Transpose</param>
/// <param name="outputs_leading_to_transpose">The set of outputs that lead to another Transpose in the graph.
///   If we can successfully push the Transpose until it meets another Transpose they can either cancel each other out,
///   or be merged into a single Transpose.
/// </param>
/// <returns>CostCheckResult indicating the action the transpose optimizer should perform.</returns>
onnx_transpose_optimization::CostCheckResult OrtEPCostCheck(
    const onnx_transpose_optimization::api::GraphRef& graph,
    const onnx_transpose_optimization::api::NodeRef& node,
    const std::vector<int64_t>& perm,
    const std::unordered_set<std::string>& outputs_leading_to_transpose);
 
/// <summary>
/// Swaps out a node for a new copy of that node with the specified op type and domain.
/// Current API does not allow nodes to have their op types or domains changed, so a new node is needed. All
/// attributes, inputs, and outputs are moved to the new node. The old node is removed from the graph and should no
/// longer be accessed.
/// </summary>
/// <param name="graph">Graph containing the node</param>
/// <param name="node">Node to copy and remove</param>
/// <param name="op_type">New node op_type</param>
/// <param name="domain">New node domain. "" for the default domain.</param>
/// <returns>The newly created node.</returns>
std::unique_ptr<onnx_transpose_optimization::api::NodeRef>
SwapNodeOpTypeAndDomain(onnx_transpose_optimization::api::GraphRef& graph,
                        onnx_transpose_optimization::api::NodeRef& node,
                        std::string_view op_type, std::string_view domain);
 
/// <summary>
/// Swaps out a node for a new copy of that node with the specified op type, domain, and since version.
/// Current API does not allow nodes to have their op types or domains changed, so a new node is needed. All
/// attributes, inputs, and outputs are moved to the new node. The old node is removed from the graph and should no
/// longer be accessed.
/// </summary>
/// <param name="graph">Graph containing the node</param>
/// <param name="node">Node to copy and remove</param>
/// <param name="op_type">New node op_type</param>
/// <param name="domain">New node domain. "" for the default domain.</param>
/// <param name="op_type">New node since version.</param>
/// <returns>The newly created node.</returns>
std::unique_ptr<onnx_transpose_optimization::api::NodeRef>
SwapNodeOpTypeDomainAndSinceVersion(onnx_transpose_optimization::api::GraphRef& graph,
                                    onnx_transpose_optimization::api::NodeRef& node,
                                    std::string_view op_type, std::string_view domain, int since_version);
}  // namespace onnxruntime