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

Function ValidateInput

tensorflow/core/util/batch_util.cc:29–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace {
28
29Status ValidateInput(const Tensor& parent, const Tensor& element, int64 index) {
30 DCHECK_NE(parent.dim_size(0), 0);
31 DCHECK_GE(index, 0);
32 if (element.NumElements() != (parent.NumElements() / parent.dim_size(0))) {
33 TensorShape chip_shape = parent.shape();
34 chip_shape.RemoveDim(0);
35 return errors::Internal(
36 "ValidateInput Cannot perform copy: number of elements does not match. "
37 " Shapes are: [element]: ",
38 element.shape().DebugString(),
39 ", [parent slice]: ", chip_shape.DebugString());
40 }
41 return Status::OK();
42}
43
44template <typename T>
45Status HandleElementToSlice(T* src, T* dest, int64 num_values,

Callers 4

CopyElementToSliceFunction · 0.70
CopySliceToElementFunction · 0.70
MaybeMoveSliceToElementFunction · 0.70
ComputeMethod · 0.50

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