diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h index caa736b000..d4d508d7b9 100644 --- a/include/onnxruntime/core/graph/graph.h +++ b/include/onnxruntime/core/graph/graph.h @@ -15,7 +15,6 @@ #include "core/common/path.h" #include "core/common/status.h" #include "core/common/logging/logging.h" -#include "core/flatbuffers/ort.fbs.h" #include "core/graph/basic_types.h" #include "core/graph/constants.h" #include "core/graph/graph_nodes.h" @@ -24,12 +23,26 @@ #include "core/graph/function.h" #include "gsl/gsl" +namespace flatbuffers { +class FlatBufferBuilder; +template +struct Offset; +} // namespace flatbuffers + namespace onnxruntime { class Graph; struct IndexedSubGraph; class Model; class OpSignature; +namespace experimental { +namespace fbs { +struct Graph; +struct Node; +struct NodeEdge; +} // namespace fbs +} // namespace experimental + /** @class Node Class representing a node in the graph. diff --git a/onnxruntime/core/framework/session_state.cc b/onnxruntime/core/framework/session_state.cc index cfbb43e04e..fd09448a1b 100644 --- a/onnxruntime/core/framework/session_state.cc +++ b/onnxruntime/core/framework/session_state.cc @@ -7,6 +7,7 @@ #include "core/common/logging/logging.h" #include "core/common/safeint.h" +#include "core/flatbuffers/ort.fbs.h" #include "core/framework/allocator.h" #include "core/framework/node_index_info.h" #include "core/framework/op_kernel.h" diff --git a/onnxruntime/core/framework/session_state.h b/onnxruntime/core/framework/session_state.h index f954959329..e7c90e9746 100644 --- a/onnxruntime/core/framework/session_state.h +++ b/onnxruntime/core/framework/session_state.h @@ -13,7 +13,6 @@ #include "core/common/common.h" #include "core/common/logging/logging.h" #include "core/common/profiler.h" -#include "core/flatbuffers/ort.fbs.h" #include "core/framework/allocation_planner.h" #include "core/framework/callback.h" #include "core/framework/data_transfer_manager.h" @@ -33,8 +32,20 @@ #include "core/platform/path_lib.h" #include "core/platform/threadpool.h" +namespace flatbuffers { +class FlatBufferBuilder; +template +struct Offset; +} // namespace flatbuffers + namespace onnxruntime { +namespace experimental { +namespace fbs { +struct SessionState; +} // namespace fbs +} // namespace experimental + class ExecutionProviders; class KernelDef; class OpKernel; diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index 3670224764..c08dfb82bb 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -14,6 +14,7 @@ #include "gsl/gsl" #include "core/common/logging/logging.h" +#include "core/flatbuffers/ort.fbs.h" #include "core/framework/tensor_shape.h" #include "core/framework/tensorprotoutils.h" #include "core/framework/utils.h" diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.cc b/onnxruntime/core/graph/graph_flatbuffers_utils.cc index 871432b8c4..55d0ac95c4 100644 --- a/onnxruntime/core/graph/graph_flatbuffers_utils.cc +++ b/onnxruntime/core/graph/graph_flatbuffers_utils.cc @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "graph_flatbuffers_utils.h" +#include +#include "core/flatbuffers/ort.fbs.h" #include "core/framework/tensorprotoutils.h" +#include "graph_flatbuffers_utils.h" using namespace ONNX_NAMESPACE; using namespace ::onnxruntime::common; diff --git a/onnxruntime/core/graph/graph_flatbuffers_utils.h b/onnxruntime/core/graph/graph_flatbuffers_utils.h index c938020969..c465768ad2 100644 --- a/onnxruntime/core/graph/graph_flatbuffers_utils.h +++ b/onnxruntime/core/graph/graph_flatbuffers_utils.h @@ -2,10 +2,25 @@ // Licensed under the MIT License. #pragma once -#include +#include "flatbuffers/flatbuffers.h" namespace onnxruntime { + +class Graph; +class Node; + +namespace logging { +class Logger; +} + namespace experimental { + +namespace fbs { +struct Attribute; +struct Tensor; +struct ValueInfo; +} // namespace fbs + namespace utils { onnxruntime::common::Status SaveValueInfoOrtFormat( diff --git a/onnxruntime/core/graph/model.cc b/onnxruntime/core/graph/model.cc index 1fea9ba4e8..e7b7547a67 100644 --- a/onnxruntime/core/graph/model.cc +++ b/onnxruntime/core/graph/model.cc @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#include "core/flatbuffers/ort.fbs.h" #include "core/framework/tensorprotoutils.h" #include "core/graph/graph_flatbuffers_utils.h" #include "core/graph/model.h" diff --git a/onnxruntime/core/graph/model.h b/onnxruntime/core/graph/model.h index 9f236e8dce..53d42475c1 100644 --- a/onnxruntime/core/graph/model.h +++ b/onnxruntime/core/graph/model.h @@ -8,13 +8,24 @@ #include #include #include "core/common/path.h" -#include "core/flatbuffers/ort.fbs.h" #include "core/graph/graph_viewer.h" #include "core/session/onnxruntime_c_api.h" #include "gsl/gsl" +namespace flatbuffers { +class FlatBufferBuilder; +template +struct Offset; +} // namespace flatbuffers + namespace onnxruntime { +namespace experimental { +namespace fbs { +struct Model; +} // namespace fbs +} // namespace experimental + typedef std::unordered_map ModelMetaData; using IOnnxRuntimeOpSchemaRegistryList = std::list>;