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

Method ValidateManyTuple

tensorflow/core/kernels/queue_base.cc:161–186  ·  view source on GitHub ↗

TODO(mrry): If these checks become a bottleneck, find a way to reduce the number of times that they are called.

Source from the content-addressed store, hash-verified

159// TODO(mrry): If these checks become a bottleneck, find a way to
160// reduce the number of times that they are called.
161Status QueueBase::ValidateManyTuple(const Tuple& tuple) {
162 TF_RETURN_IF_ERROR(ValidateTupleCommon(tuple));
163 const int64 batch_size = tuple[0].dim_size(0);
164 if (specified_shapes()) {
165 for (size_t i = 0; i < tuple.size(); ++i) {
166 // Expected shape is [batch_size] + component_shapes_[i]
167 const TensorShape expected_shape = ManyOutShape(i, batch_size);
168 if (!expected_shape.IsSameSize(tuple[i].shape())) {
169 return errors::InvalidArgument("Shape mismatch in tuple component ", i,
170 ". Expected ",
171 expected_shape.DebugString(), ", got ",
172 tuple[i].shape().DebugString());
173 }
174 }
175 } else {
176 for (size_t i = 1; i < tuple.size(); ++i) {
177 if (tuple[i].dim_size(0) != batch_size) {
178 return errors::InvalidArgument(
179 "All input tensors must have the same size in the 0th ",
180 "dimension. Component ", i, " has ", tuple[i].dim_size(0),
181 ", and should have ", batch_size);
182 }
183 }
184 }
185 return Status::OK();
186}
187
188void QueueBase::Cancel(Action action, CancellationManager* cancellation_manager,
189 CancellationToken token) {

Callers 1

ComputeAsyncMethod · 0.45

Calls 8

specified_shapesFunction · 0.85
ManyOutShapeFunction · 0.85
InvalidArgumentFunction · 0.85
dim_sizeMethod · 0.45
sizeMethod · 0.45
IsSameSizeMethod · 0.45
shapeMethod · 0.45
DebugStringMethod · 0.45

Tested by

no test coverage detected