| // Copyright 2020 The IREE Authors |
| // Licensed under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| #include "iree_tf_compiler/TF/Passes.h" |
| #include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" |
| namespace iree_integrations { |
| : public PassWrapper<StripAssertsPass, OperationPass<func::FuncOp>> { |
| StringRef getArgument() const override { return "iree-tf-strip-asserts"; } |
| StringRef getDescription() const override { return "Remove tf.Assert ops"; } |
| void runOnOperation() override { |
| auto funcOp = getOperation(); |
| DenseSet<Operation *> assertOps; |
| funcOp.walk([&](Operation *op) { |
| if (isa<mlir::TF::AssertOp>(op)) { |
| for (Operation *assertOp : assertOps) { |
| std::unique_ptr<OperationPass<func::FuncOp>> createStripAssertsPass() { |
| return std::make_unique<StripAssertsPass>(); |
| static PassRegistration<StripAssertsPass> funcPass; |
| } // namespace iree_integrations |