Returns the index of the batch dimension.
| 170 | |
| 171 | // Returns the index of the batch dimension. |
| 172 | inline 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 |
no outgoing calls