diff options
author | 2018-10-04 13:20:58 -0700 | |
---|---|---|
committer | 2018-10-04 13:29:39 -0700 | |
commit | 589e876139f4c7fbdf96edaa16fdcfe12c7a4b03 (patch) | |
tree | 6526109ff31ef138018badf3469852c07b84e170 /tensorflow/core/kernels | |
parent | 23a698e670a10eff362c575eb1297c2b4f0bbe11 (diff) |
Error out when PartitionedCall is created with the wrong number of arguments.
(used to be a segfault)
PiperOrigin-RevId: 215791737
Diffstat (limited to 'tensorflow/core/kernels')
-rw-r--r-- | tensorflow/core/kernels/partitioned_function_ops.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tensorflow/core/kernels/partitioned_function_ops.cc b/tensorflow/core/kernels/partitioned_function_ops.cc index fdb4c84c46..3979e4b53a 100644 --- a/tensorflow/core/kernels/partitioned_function_ops.cc +++ b/tensorflow/core/kernels/partitioned_function_ops.cc @@ -97,6 +97,13 @@ class PartitionedCallOp : public AsyncOpKernel { OP_REQUIRES_ASYNC(ctx, fbody != nullptr, errors::Internal("Could not find handle ", handle), done); + OP_REQUIRES_ASYNC( + ctx, args.size() == fbody->arg_nodes.size(), + errors::InvalidArgument( + "Wrong number of arguments to the op; function expects ", + fbody->arg_nodes.size(), " but PartitionedCall received ", + args.size()), + done); // We need to pass global op_registry as default_registry when creating // graph. So that graph optimization passes can lookup all possible ops // by name. |