| 52 | namespace tensorflow { |
| 53 | |
| 54 | Status GetHandle(OpKernelContext* ctx, string* container, string* ta_handle) { |
| 55 | { |
| 56 | Tensor tensor; |
| 57 | // Assuming that handle is the input at index 0. |
| 58 | if (IsRefType(ctx->input_dtype(0))) { |
| 59 | tensor = ctx->mutable_input(0, false); |
| 60 | } else { |
| 61 | tensor = ctx->input(0); |
| 62 | } |
| 63 | if (tensor.NumElements() != 2) { |
| 64 | return errors::InvalidArgument( |
| 65 | "Tensor array handle must be 2-element vector, but had shape: ", |
| 66 | tensor.shape().DebugString()); |
| 67 | } |
| 68 | auto h = tensor.flat<tstring>(); |
| 69 | *container = h(0); |
| 70 | *ta_handle = h(1); |
| 71 | } |
| 72 | return Status::OK(); |
| 73 | } |
| 74 | |
| 75 | Status GetTensorArray(OpKernelContext* ctx, TensorArray** tensor_array) { |
| 76 | string container; |
no test coverage detected