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

Function GetTensorBatchDimIndex

tensorflow/core/util/tensor_format.h:172–187  ·  view source on GitHub ↗

Returns the index of the batch dimension.

Source from the content-addressed store, hash-verified

170
171// Returns the index of the batch dimension.
172inline int GetTensorBatchDimIndex(int num_dims, TensorFormat format) {
173 switch (format) {
174 case FORMAT_NHWC:
175 case FORMAT_NCHW:
176 case FORMAT_NCHW_VECT_C:
177 case FORMAT_NHWC_VECT_W:
178 return 0;
179 case FORMAT_HWNC:
180 return num_dims - 2;
181 case FORMAT_HWCN:
182 return num_dims - 1;
183 default:
184 LOG(FATAL) << "Unknown format " << format;
185 return -1; // Avoid compiler warning about missing return value
186 }
187}
188
189// Returns the index of the feature dimension. If format is NCHW_VECT_C, returns
190// the index of the outer feature dimension (i.e. dimension 1, whose size would

Callers 15

matchAndRewriteMethod · 0.85
matchAndRewriteMethod · 0.85
CheckConvAttrsFunction · 0.85
MakeXlaForwardConvOpFunction · 0.85
CompileImplMethod · 0.85
XlaTensorFormatFunction · 0.85
CompileMethod · 0.85
MakeShapeFromFormatFunction · 0.85
DimensionsFromShapeFunction · 0.85

Calls

no outgoing calls

Tested by 1

RunDimensionIndexesTestFunction · 0.68