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

Function GetTensorFeatureDimIndex

tensorflow/core/util/tensor_format.h:192–207  ·  view source on GitHub ↗

Returns the index of the feature dimension. If format is NCHW_VECT_C, returns the index of the outer feature dimension (i.e. dimension 1, whose size would be num_features / 4 in this case).

Source from the content-addressed store, hash-verified

190// the index of the outer feature dimension (i.e. dimension 1, whose size would
191// be num_features / 4 in this case).
192inline int GetTensorFeatureDimIndex(int num_dims, TensorFormat format) {
193 switch (format) {
194 case FORMAT_NHWC:
195 case FORMAT_HWNC:
196 return num_dims - 1;
197 case FORMAT_NHWC_VECT_W:
198 case FORMAT_HWCN:
199 return num_dims - 2;
200 case FORMAT_NCHW:
201 case FORMAT_NCHW_VECT_C:
202 return 1;
203 default:
204 LOG(FATAL) << "Unknown format " << format;
205 return -1; // Avoid compiler warning about missing return value
206 }
207}
208
209// Returns the index of the inner feature dimension.
210inline int GetTensorInnerFeatureDimIndex(int num_dims, TensorFormat format) {

Callers 15

VerifyFunction · 0.85
matchAndRewriteMethod · 0.85
matchAndRewriteMethod · 0.85
matchAndRewriteMethod · 0.85
CheckConvAttrsFunction · 0.85
MakeXlaForwardConvOpFunction · 0.85
CompileImplMethod · 0.85
CompileImplMethod · 0.85

Calls

no outgoing calls

Tested by 1

RunDimensionIndexesTestFunction · 0.68