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

Function GetTensorDimsFromSpatialDims

tensorflow/core/util/tensor_format.h:143–158  ·  view source on GitHub ↗

Returns the rank of a tensor with 'num_spatial_dims' spatial dimensions and tensor format 'format'. This is the inverse of GetTensorSpatialDims.

Source from the content-addressed store, hash-verified

141// Returns the rank of a tensor with 'num_spatial_dims' spatial dimensions and
142// tensor format 'format'. This is the inverse of GetTensorSpatialDims.
143inline int GetTensorDimsFromSpatialDims(int num_spatial_dims,
144 TensorFormat format) {
145 switch (format) {
146 case FORMAT_NHWC:
147 case FORMAT_NCHW:
148 case FORMAT_HWNC:
149 case FORMAT_HWCN:
150 return num_spatial_dims + 2; // Include N,C.
151 case FORMAT_NCHW_VECT_C:
152 case FORMAT_NHWC_VECT_W:
153 return num_spatial_dims + 3; // Include N,C,VectDim.
154 default:
155 LOG(FATAL) << "Unknown format " << format;
156 return -1; // Avoid compiler warning about missing return value
157 }
158}
159
160// Returns the rank of a tensor with 'num_spatial_dims' spatial dimensions and
161// filter tensor format 'format'.

Callers 8

array_ops.ccFile · 0.85
MakeShapeFromFormatFunction · 0.85
DimensionsFromShapeFunction · 0.85
ShapeFromDimensionsFunction · 0.85
Conv2DShapeImplFunction · 0.85
ShapeFromFormatFunction · 0.85
RunDimensionIndexesTestFunction · 0.85

Calls

no outgoing calls

Tested by 1

RunDimensionIndexesTestFunction · 0.68