| 179 | } |
| 180 | |
| 181 | unsigned int TensorShape::GetNumElements() const |
| 182 | { |
| 183 | CheckUnspecifiedNumDimensions(); |
| 184 | |
| 185 | if (m_NumDimensions == 0) |
| 186 | { |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | unsigned int count = 1; |
| 191 | bool atLeastOneDimensionSpecified = false; |
| 192 | for (unsigned int i = 0; i < m_NumDimensions; ++i) |
| 193 | { |
| 194 | if (m_DimensionsSpecificity[i]) |
| 195 | { |
| 196 | atLeastOneDimensionSpecified = true; |
| 197 | count *= m_Dimensions[i]; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | if (atLeastOneDimensionSpecified) |
| 202 | { |
| 203 | return count; |
| 204 | } |
| 205 | else |
| 206 | { |
| 207 | return 0; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | bool TensorShape:: GetDimensionSpecificity(unsigned int i) const |
| 212 | { |
no outgoing calls