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

Method IsValidShape

tensorflow/core/framework/tensor_shape_test.cc:364–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364Status TensorShapeOld::IsValidShape(const TensorShapeProto& proto) {
365 int64 num_elements = 1;
366 for (const auto& d : proto.dim()) {
367 if (d.size() < 0) {
368 return errors::InvalidArgument("Shape ", DebugString(proto),
369 " has negative dimensions; ",
370 "perhaps an un-fed placeholder?");
371 }
372 num_elements *= d.size();
373 if (num_elements > kMaxElements) {
374 return errors::InvalidArgument("Shape ", DebugString(proto),
375 " is too large (more than ", kMaxElements,
376 " entries)");
377 }
378 }
379 return Status::OK();
380}
381
382TensorShapeOld::TensorShapeOld(const TensorShapeProto& proto) {
383 dim_sizes_.reserve(proto.dim_size());

Callers

nothing calls this directly

Calls 4

InvalidArgumentFunction · 0.85
DebugStringFunction · 0.70
dimMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected