MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / MaybeMoveSliceToElement

Function MaybeMoveSliceToElement

tensorflow/core/util/batch_util.cc:187–207  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

185// NOTE(mrry): The implementation may be able to optimize the copy to a move.
186// This is particularly important for DT_STRING tensors.
187Status 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

Callers 1

GetNextInternalMethod · 0.85

Calls 4

UnimplementedFunction · 0.85
ValidateInputFunction · 0.70
RefCountIsOneMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected