From 919c8f27384de150a806d0b8d83e235f1f2f803d Mon Sep 17 00:00:00 2001 From: Michael Gester Date: Tue, 29 Dec 2020 16:19:24 -0800 Subject: [PATCH] Added error message for unsupported uninitialized resource variables Previously, we ran into a generic error message when encountering unsupported uninitialized resource variables so it wasn't clear what the actual problem was. PiperOrigin-RevId: 349483176 Change-Id: Id3819e7c7802d2b2decdd63c8292de88fadcd0ae --- .../compiler/mlir/tensorflow/utils/compile_mlir_util.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.cc b/tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.cc index 6b09455d9c0..26741f30ed8 100644 --- a/tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.cc +++ b/tensorflow/compiler/mlir/tensorflow/utils/compile_mlir_util.cc @@ -529,6 +529,12 @@ static StatusOr> RewriteWithArgs( mlir::BlockArgument mlir_arg = main_fn.getArgument(idx); if (xla_arg.kind == XlaArgument::kResource) { mlir::Type element_type; + if (xla_arg.type == DT_INVALID) { + return errors::Unimplemented(absl::StrCat( + "Argument ", idx, + " is an uninitialized resource variable which is currently" + " unsupported in the MLIR-based TPU bridge")); + } TF_RETURN_IF_ERROR(ConvertDataType(xla_arg.type, builder, &element_type)); TF_ASSIGN_OR_RETURN(TensorShape arg_shape, GetTensorShapeFromXlaArgument(xla_arg));