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
This commit is contained in:
Michael Gester 2020-12-29 16:19:24 -08:00 committed by TensorFlower Gardener
parent 8ea9e8cfab
commit 919c8f2738

View File

@ -529,6 +529,12 @@ static StatusOr<std::vector<int>> 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));