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

Function CopyElementToSlice

tensorflow/core/util/batch_util.cc:138–159  ·  view source on GitHub ↗

Copies element into the index^th slice of parent (in the 0th dimension).

Source from the content-addressed store, hash-verified

136
137// Copies element into the index^th slice of parent (in the 0th dimension).
138Status CopyElementToSlice(Tensor element, Tensor* parent, int64 index) {
139 TF_RETURN_IF_ERROR(ValidateInput(*parent, element, index));
140 const int64 num_values = element.NumElements();
141 bool can_move = element.RefCountIsOne();
142#define HANDLE_TYPE(T) \
143 case DataTypeToEnum<T>::value: { \
144 T* src = element.base<T>(); \
145 T* dest = parent->base<T>() + (num_values * index); \
146 return HandleElementToSlice<T>(src, dest, num_values, can_move); \
147 }
148
149 switch (element.dtype()) {
150 TF_CALL_ALL_TYPES(HANDLE_TYPE);
151 TF_CALL_QUANTIZED_TYPES(HANDLE_TYPE);
152 TF_CALL_uint32(HANDLE_TYPE);
153 TF_CALL_uint64(HANDLE_TYPE);
154#undef HANDLE_TYPE
155 default:
156 return errors::Unimplemented("CopyElementToSlice Unhandled data type: ",
157 element.dtype());
158 }
159}
160
161// Copies the index^th slice of parent (in the 0th dimension) into element.
162Status CopySliceToElement(const Tensor& parent, Tensor* element, int64 index) {

Callers 11

CopyElementToSliceMethod · 0.85
TryInsertManyMethod · 0.85
TryDequeueManyMethod · 0.85
TryDequeueManyMethod · 0.85
TryDequeueManyMethod · 0.85
TryDequeueManyMethod · 0.85
GetNextInternalMethod · 0.85
GetNextInternalMethod · 0.85
SetRetvalMethod · 0.85
IteratorClass · 0.85
GetNextInternalMethod · 0.85

Calls 5

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

Tested by

no test coverage detected