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

Function FindMinMax

src/armnnUtils/TensorUtils.cpp:81–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81std::pair<float, float> FindMinMax(ITensorHandle* tensorHandle)
82{
83 auto tensor_data = static_cast<const float *>(tensorHandle->Map(true));
84 auto tensor_size = tensorHandle->GetShape().GetNumElements();
85
86 // Set min/max initially to first value in tensor
87 float min = tensor_data[0];
88 float max = tensor_data[0];
89
90 // Loop over rest of tensor and update min/max if necessary
91 for (unsigned int val = 1; val < tensor_size; val++)
92 {
93 if (tensor_data[val] < min)
94 {
95 min = tensor_data[val];
96 }
97 else if (tensor_data[val] > max)
98 {
99 max = tensor_data[val];
100 }
101 }
102
103 tensorHandle->Unmap();
104
105 return std::make_pair(min, max);
106}
107
108TensorShape ReduceDims(const TensorShape& tensorShape, unsigned int dimensions)
109{

Callers

nothing calls this directly

Calls 4

MapMethod · 0.45
GetNumElementsMethod · 0.45
GetShapeMethod · 0.45
UnmapMethod · 0.45

Tested by

no test coverage detected