1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include "tensorflow/compiler/mlir/lite/utils/stateful_ops_utils.h" 17 18 #include <vector> 19 20 #include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project 21 #include "tensorflow/compiler/mlir/lite/ir/tfl_ops.h" 22 23 namespace mlir { 24 namespace TFL { 25 IsStatefulOp(Operation * op,std::vector<int> * stateful_operand_indices)26bool IsStatefulOp(Operation* op, std::vector<int>* stateful_operand_indices) { 27 if (auto stateful_op = dyn_cast_or_null<StatefulOpInterface>(op)) { 28 *stateful_operand_indices = stateful_op.GetStatefulOperands(); 29 return true; 30 } 31 32 return false; 33 } 34 35 } // namespace TFL 36 } // namespace mlir 37