onnxruntime/onnxruntime/core/optimizer/graph_transformer.cc
Changming Sun 109b3cb450
Avoid using the default logger in the graph lib and optimizers (#2361)
1. Use the session logger if it is available.
2. Don't disable warning 4100 globally. We should fix the warnings instead of disabling it.
2019-11-14 13:23:28 -08:00

26 lines
859 B
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());
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();
}
return status;
}
} // namespace onnxruntime