mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-06 04:28:32 +00:00
* Initial set of changes to start disabling code in the minimal build. Breaking changes into multiple PRs so they're more easily reviewed. Focus on InferenceSession, Model and Graph here. SessionState will be next. Needs to be integrated with de/serialization code before being testable so changes are all off by default. Changes are limited to - #ifdef'ing out code - moving some things around so there are fewer #ifdef statements - moving definition of some one-line methods into the header so we don't need to #ifdef out in a .cc as well - exclude some things in the cmake setup * Update session state and a few other places. The core code builds if ORT_MINIMAL_BUILD is specified.
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#include "core/optimizer/graph_transformer.h"
|
|
|
|
using namespace ::onnxruntime::common;
|
|
|
|
namespace onnxruntime {
|
|
|
|
Status GraphTransformer::Apply(Graph& graph, bool& modified, const logging::Logger& logger) const {
|
|
// the Graph should be in a good state prior this being called, so there should be no need to call Resolve here
|
|
// ORT_RETURN_IF_ERROR(graph.Resolve());
|
|
|
|
#if !defined(ORT_MINIMAL_BUILD)
|
|
auto status = ApplyImpl(graph, modified, 0, logger);
|
|
ORT_RETURN_IF_ERROR(status);
|
|
|
|
// At least currently, some transformers (InsertCastTransformer and MemcpyTransformer) need this to be called
|
|
// after they complete to put the graph back into a valid state for the next transformer.
|
|
if (modified) {
|
|
status = graph.Resolve();
|
|
}
|
|
#else
|
|
ORT_UNUSED_PARAMETER(graph);
|
|
ORT_UNUSED_PARAMETER(modified);
|
|
ORT_UNUSED_PARAMETER(logger);
|
|
Status status(ONNXRUNTIME, FAIL, "Transformers are not supported in this build");
|
|
#endif
|
|
return status;
|
|
}
|
|
|
|
} // namespace onnxruntime
|