// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "optimizer_api.h"
#include "core/graph/graph.h"
#include "core/framework/execution_provider.h"
#include "core/framework/transform_layout_functions.h"
namespace onnxruntime {
///
/// Creates concrete implementation of api for transpose optimizer. IMPORTANT: graph must have up-to-date edges,
/// node_arg-to-producer, and node_arg-to-consumer relationships. Otherwise call Resolve() before this.
///
/// ORT Graph to wrap with API
/// Allocator used for reshaping/transposing tensors
/// New nodes are assigned to this EP, or left unassigned if nullptr
/// api::GraphRef for use with transpose optimizer
std::unique_ptr MakeApiGraph(onnxruntime::Graph& graph,
AllocatorPtr cpu_allocator,
const char* new_node_ep);
///
/// Creates NodeRef.
///
/// ORT Graph which owns the node
/// ORT Node to wrap with API.
/// api::NodeRef for use with transpose optimizer
std::unique_ptr MakeApiNode(onnxruntime::Graph& graph,
onnxruntime::Node& node);
///
/// Reveals underlying ORT graph from an api::GraphRef
///
/// api:GraphRef created from MakeApiGraph
/// ORT graph
onnxruntime::Graph& GraphFromApiGraph(onnx_transpose_optimization::api::GraphRef& graph);
///
/// Reveals underlying ORT node from an api::NodeRef
///
/// api:NodeRef from graph created from MakeApiGraph
/// ORT node
onnxruntime::Node& NodeFromApiNode(onnx_transpose_optimization::api::NodeRef& node);
} // namespace onnxruntime