MCPcopy Create free account
hub / github.com/ARM-software/armnn / GetNumElementsBetween

Function GetNumElementsBetween

src/armnnUtils/TensorUtils.cpp:209–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209unsigned int GetNumElementsBetween(const TensorShape& shape,
210 const unsigned int firstAxisInclusive,
211 const unsigned int lastAxisExclusive)
212{
213 if (firstAxisInclusive > lastAxisExclusive)
214 {
215 throw armnn::InvalidArgumentException(fmt::format(
216 "GetNumElementsBetween: firstAxisInclusive [{}D] is greater than lastAxisExclusive [{}D]",
217 firstAxisInclusive,
218 lastAxisExclusive));
219 }
220 if (lastAxisExclusive > shape.GetNumDimensions())
221 {
222 throw armnn::InvalidArgumentException(fmt::format(
223 "{}: lastAxisExclusive [{}D] is greater than the number of dimensions of the tensor shape [{}D]"
224 "GetNumElementsBetween",
225 lastAxisExclusive,
226 shape.GetNumDimensions()));
227 }
228 unsigned int count = 1;
229 for (unsigned int i = firstAxisInclusive; i < lastAxisExclusive; i++)
230 {
231 count *= shape[i];
232 }
233 return count;
234}
235
236unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis)
237{

Callers 3

ArgMinMaxFunction · 0.85
LogSoftmaxFunction · 0.85
SoftmaxFunction · 0.85

Calls 3

formatEnum · 0.85
GetNumDimensionsMethod · 0.45

Tested by

no test coverage detected