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

Function HandleSliceToElement

tensorflow/core/kernels/queue_base.cc:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30template <DataType DT>
31Status HandleSliceToElement(const Tensor& parent, Tensor* element,
32 int64 index) {
33 typedef typename EnumToDataType<DT>::Type T;
34 DCHECK_NE(parent.dim_size(0), 0);
35 DCHECK_GE(index, 0);
36 if (element->NumElements() != (parent.NumElements() / parent.dim_size(0))) {
37 TensorShape chip_shape = parent.shape();
38 chip_shape.RemoveDim(0);
39 return errors::Internal(
40 "HandleSliceToElement Cannot copy slice: number of elements does not "
41 "match. Shapes are: [element]: ",
42 element->shape().DebugString(),
43 ", [parent slice]: ", chip_shape.DebugString());
44 }
45 auto parent_as_matrix = parent.flat_outer_dims<T>();
46 element->flat<T>() = parent_as_matrix.chip(index, 0);
47 return Status::OK();
48}
49
50} // namespace
51

Callers

nothing calls this directly

Calls 6

InternalFunction · 0.85
dim_sizeMethod · 0.45
NumElementsMethod · 0.45
shapeMethod · 0.45
RemoveDimMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected