Make the tf2xla "tensor list size not set" error message a bit more ergonomic
PiperOrigin-RevId: 312917264 Change-Id: I14c373860aafed5050ac42510d341fab95307c8d
This commit is contained in:
parent
df5e319d05
commit
144b3dc790
@ -136,11 +136,8 @@ class TensorListReserveOp : public XlaOpKernel {
|
|||||||
OP_REQUIRES_OK(ctx, ctx->ConstantInputAsIntScalar(1, &num_elements));
|
OP_REQUIRES_OK(ctx, ctx->ConstantInputAsIntScalar(1, &num_elements));
|
||||||
OP_REQUIRES(
|
OP_REQUIRES(
|
||||||
ctx, num_elements >= 0,
|
ctx, num_elements >= 0,
|
||||||
errors::InvalidArgument(
|
errors::InvalidArgument("XLA compilation requires a fixed tensor list "
|
||||||
"XLA compilation requires a fixed tensor list size. Set the number "
|
"size. Set the number of elements."));
|
||||||
"of elements. This could also happen if you're using a TensorArray "
|
|
||||||
"in a while loop that does not have its maximum_iteration set, you "
|
|
||||||
"can fix this by setting maximum_iteration to a suitable value."));
|
|
||||||
|
|
||||||
// If element shape is compile time constant and it's not "unknown rank"
|
// If element shape is compile time constant and it's not "unknown rank"
|
||||||
// shape (-1), create an initialized TensorList. Otherwise create an
|
// shape (-1), create an initialized TensorList. Otherwise create an
|
||||||
@ -200,13 +197,10 @@ class EmptyTensorListOp : public XlaOpKernel {
|
|||||||
void Compile(XlaOpKernelContext* ctx) override {
|
void Compile(XlaOpKernelContext* ctx) override {
|
||||||
int64 max_num_elements;
|
int64 max_num_elements;
|
||||||
OP_REQUIRES_OK(ctx, ctx->ConstantInputAsIntScalar(1, &max_num_elements));
|
OP_REQUIRES_OK(ctx, ctx->ConstantInputAsIntScalar(1, &max_num_elements));
|
||||||
OP_REQUIRES(ctx, max_num_elements >= 0,
|
OP_REQUIRES(
|
||||||
errors::InvalidArgument(
|
ctx, max_num_elements >= 0,
|
||||||
"XLA compilation requires a fixed tensor list size. Set "
|
errors::InvalidArgument("XLA compilation requires a fixed tensor list "
|
||||||
"the max number of elements. This could also happen if "
|
"size. Set the max number of elements."));
|
||||||
"you're using a TensorArray in a while loop that does not "
|
|
||||||
"have its maximum_iteration set, you can fix this by "
|
|
||||||
"setting maximum_iteration to a suitable value."));
|
|
||||||
|
|
||||||
if (dtype_ != DT_VARIANT) {
|
if (dtype_ != DT_VARIANT) {
|
||||||
// We are creating a non-nested TensorList.
|
// We are creating a non-nested TensorList.
|
||||||
|
Loading…
Reference in New Issue
Block a user