Copies the index^th slice of parent (in the 0th dimension) into element. NOTE(mrry): The implementation may be able to optimize the copy to a move. This is particularly important for DT_STRING tensors.
| 185 | // NOTE(mrry): The implementation may be able to optimize the copy to a move. |
| 186 | // This is particularly important for DT_STRING tensors. |
| 187 | Status MaybeMoveSliceToElement(Tensor* parent, Tensor* element, int64 index) { |
| 188 | TF_RETURN_IF_ERROR(ValidateInput(*parent, *element, index)); |
| 189 | bool can_move = parent->RefCountIsOne(); |
| 190 | |
| 191 | #define HANDLE_TYPE(T) \ |
| 192 | case DataTypeToEnum<T>::value: { \ |
| 193 | HandleSliceToElement<T>(parent, element, index, can_move); \ |
| 194 | return Status::OK(); \ |
| 195 | } |
| 196 | |
| 197 | switch (parent->dtype()) { |
| 198 | TF_CALL_ALL_TYPES(HANDLE_TYPE); |
| 199 | TF_CALL_QUANTIZED_TYPES(HANDLE_TYPE); |
| 200 | TF_CALL_uint32(HANDLE_TYPE); |
| 201 | TF_CALL_uint64(HANDLE_TYPE); |
| 202 | #undef HANDLE_TYPE |
| 203 | default: |
| 204 | return errors::Unimplemented( |
| 205 | "MaybeMoveSliceToElement Unhandled data type: ", element->dtype()); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | // The following five functions are copied from padding_fifo_queue.cc. |
| 210 | // TODO(mrry): Reconcile these functions with the similar methods in the |
no test coverage detected