Update some out of date comments.
PiperOrigin-RevId: 377943618
Change-Id: I0195b9d47d6f6a0a73381ddae1ff8fd24a80d318
diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf-ops.mlir b/tensorflow/compiler/mlir/tensorflow/tests/tf-ops.mlir
index ed01c88..aa9baa3 100644
--- a/tensorflow/compiler/mlir/tensorflow/tests/tf-ops.mlir
+++ b/tensorflow/compiler/mlir/tensorflow/tests/tf-ops.mlir
@@ -42,8 +42,8 @@
// -----
// CHECK-LABEL: func @testIdentity
-func @testIdentity(%arg0: tensor<4x2x!tf.stringref>) -> tensor<4x2x!tf.string> {
- %0 = "tf.Identity"(%arg0) : (tensor<4x2x!tf.stringref>) -> tensor<4x2x!tf.string>
+func @testIdentity(%arg0: tensor<4x?x!tf.stringref>) -> tensor<4x2x!tf.string> {
+ %0 = "tf.Identity"(%arg0) : (tensor<4x?x!tf.stringref>) -> tensor<4x2x!tf.string>
return %0 : tensor<4x2x!tf.string>
}
diff --git a/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc b/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc
index f8ed9ff..a51d269 100644
--- a/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc
+++ b/tensorflow/compiler/mlir/tensorflow/translate/import_model.cc
@@ -810,19 +810,10 @@
// We currently have no other way to get shapes from ReadVariableOp's.
// Some graphs seem to have _output_shapes attributes on them, so use that
// if possible.
- // TODO(silvasean): Ideally, we would do this in a separate shape inference
- // pass to avoid adding complexity to the importer. But right now, we don't
- // have an MLIR-native shape inference pass, so we need to do this while we
- // still have the Graph around, i.e. here, in the importer.
+ // Note: _output_shapes are optionally set when the user exports the graph
+ // and it is not guaranteed (nor an error if missing). There is not a
+ // promised contract, so effectively a heuristic.
if (node->op_def().name() == "ReadVariableOp") {
- // TODO(silvasean): In some graphs, this seems to be annotated on every
- // node. Why and by whom?
- // TODO(b/140588338): We should ideally incorporate that information for
- // all nodes, but right now, this can result in e.g. an Identity node with
- // signature such as
- // `(tensor<?x?xf32>) -> tensor<?x9216xf32>` which fails the verifier
- // (which checks for exact type equality; _output_shapes results in
- // us shoehorning in the more-precise type on the output).
if (const AttrValue* attr = node->attrs().Find("_output_shapes"))
TF_RETURN_IF_ERROR(set_shape_from_list_attr(attr));
}