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

Function IsScalar

tensorflow/core/grappler/optimizers/remapper.cc:446–458  ·  view source on GitHub ↗

Returns true if it is a scalar

Source from the content-addressed store, hash-verified

444
445// Returns true if it is a scalar
446bool IsScalar(const TensorShapeProto& proto) {
447 // Returns false when rank is unknown
448 if (proto.unknown_rank()) {
449 return false;
450 }
451 // Returns false when dimension is unknown
452 for (const auto& dim : proto.dim()) {
453 if (dim.size() < 0) {
454 return false;
455 }
456 }
457 return (TensorShape(proto).num_elements() == 1);
458}
459
460bool FindContractionWithBias(const RemapperContext& ctx, int node_index,
461 ContractionWithBiasAdd* matched,

Callers 15

FindContractionWithMulFunction · 0.70
ComputeMethod · 0.50
ParseScalarArgumentFunction · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
ComputeMethod · 0.50
SplitBuilderStateMethod · 0.50

Calls 5

unknown_rankMethod · 0.80
TensorShapeClass · 0.50
dimMethod · 0.45
sizeMethod · 0.45
num_elementsMethod · 0.45

Tested by 6

VFunction · 0.40
VFunction · 0.40
VFunction · 0.40
IsDatasetTensorMethod · 0.40
VFunction · 0.40
VFunction · 0.40