diff --git a/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc b/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc index 56c2c04e8da..8d7e764f64d 100644 --- a/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc +++ b/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc @@ -440,6 +440,9 @@ class ImporterBase { protected: // Maps feed as TensorId to new Placeholder node name. absl::flat_hash_map remapped_feeds_; + + // All the TF ops encountered that aren't modelled in dialect. + llvm::DenseSet unmodelled_op_types_; }; // Returns true if the node with given name has a non primary output that is @@ -1784,6 +1787,19 @@ mlir::Operation* ImporterBase::CreateOperation( } } + mlir::OperationName name = inner_op->getName(); + if (!name.getAbstractOperation() && + // Skip unmodelled ops that are handled differently. + (node_type_name != "_Arg" && node_type_name != "_Retval")) { + if (unmodelled_op_types_.insert(name.getIdentifier()).second) { + LOG(WARNING) << "Unmodelled op type `" << node.type_string() << "`" + << (node.op_def().is_stateful() + ? " is stateful but effects not modelled" + : " is not stateful but will be treated as such " + "conservatively"); + } + } + // Add the terminator for the island island_builder.create(result.location, inner_op->getResults());