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

Function RecordLabelToDimension

tensorflow/core/kernels/einsum_op.cc:191–205  ·  view source on GitHub ↗

Record and validate the label to dimension mapping. Must be a named (non-broadcasting) label as broadcasting labels don't have a fixed dimension.

Source from the content-addressed store, hash-verified

189// Record and validate the label to dimension mapping. Must be a named
190// (non-broadcasting) label as broadcasting labels don't have a fixed dimension.
191Status RecordLabelToDimension(const int label, const int axis,
192 const Tensor& input,
193 LabelToDimSizes* label_to_dim_sizes) {
194 const int64 input_dim = input.dim_size(axis);
195 // We know that label_to_dim_sizes has the size to accommodate named labels.
196 if (label_to_dim_sizes->at(label) != 0 &&
197 label_to_dim_sizes->at(label) != input_dim) {
198 return errors::InvalidArgument(
199 "Expected dimension ", label_to_dim_sizes->at(label), " at axis ", axis,
200 " of the input shaped ", input.shape().DebugString(),
201 " but got dimension ", input_dim);
202 }
203 (*label_to_dim_sizes)[label] = input_dim;
204 return Status::OK();
205}
206
207// Validate input dimensions and populate unnamed labels and their label counts.
208Status ProcessDimensions(const OpInputList& inputs,

Callers 1

ProcessDimensionsFunction · 0.85

Calls 5

InvalidArgumentFunction · 0.85
dim_sizeMethod · 0.45
atMethod · 0.45
DebugStringMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected