mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-27 03:11:28 +00:00
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.
31 lines
862 B
C++
31 lines
862 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include "core/optimizer/rewrite_rule.h"
|
|
|
|
namespace onnxruntime {
|
|
|
|
/**
|
|
@Class EliminateSlice
|
|
|
|
Rewrite rule that eliminates a slice operator if it is redundant (does not lead to data reduction).
|
|
|
|
It is attempted to be triggered only on nodes with op type "Slice".
|
|
*/
|
|
class EliminateSlice : public RewriteRule {
|
|
public:
|
|
EliminateSlice() noexcept : RewriteRule("EliminateSlice") {}
|
|
|
|
std::vector<std::string> TargetOpTypes() const noexcept override {
|
|
return {"Slice"};
|
|
}
|
|
|
|
private:
|
|
bool SatisfyCondition(const Graph& graph, const Node& node, const logging::Logger& logger) const override;
|
|
|
|
Status Apply(Graph& graph, Node& node, RewriteRuleEffect& rule_effect, const logging::Logger& logger) const override;
|
|
};
|
|
|
|
} // namespace onnxruntime
|