aboutsummaryrefslogtreecommitdiff
path: root/utils/GraphUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/GraphUtils.cpp')
-rw-r--r--utils/GraphUtils.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp
index 6b3dffc1a4..2ff40b7fbb 100644
--- a/utils/GraphUtils.cpp
+++ b/utils/GraphUtils.cpp
@@ -30,13 +30,7 @@
#include "arm_compute/runtime/CL/CLTensor.h"
#endif /* ARM_COMPUTE_CL */
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/PixelValue.h"
-
-#include <algorithm>
#include <iomanip>
-#include <ostream>
-#include <random>
using namespace arm_compute::graph_utils;
@@ -80,8 +74,10 @@ bool DummyAccessor::access_tensor(ITensor &tensor)
return ret;
}
-PPMAccessor::PPMAccessor(const std::string &ppm_path, bool bgr, float mean_r, float mean_g, float mean_b)
- : _ppm_path(ppm_path), _bgr(bgr), _mean_r(mean_r), _mean_g(mean_g), _mean_b(mean_b)
+PPMAccessor::PPMAccessor(std::string ppm_path, bool bgr,
+ float mean_r, float mean_g, float mean_b,
+ float std_r, float std_g, float std_b)
+ : _ppm_path(std::move(ppm_path)), _bgr(bgr), _mean_r(mean_r), _mean_g(mean_g), _mean_b(mean_b), _std_r(std_r), _std_g(std_g), _std_b(std_b)
{
}
@@ -94,6 +90,12 @@ bool PPMAccessor::access_tensor(ITensor &tensor)
_mean_g,
_bgr ? _mean_r : _mean_b
};
+ const float std[3] =
+ {
+ _bgr ? _std_b : _std_r,
+ _std_g,
+ _bgr ? _std_r : _std_b
+ };
// Open PPM file
ppm.open(_ppm_path);
@@ -111,7 +113,7 @@ bool PPMAccessor::access_tensor(ITensor &tensor)
execute_window_loop(window, [&](const Coordinates & id)
{
const float value = *reinterpret_cast<float *>(tensor.ptr_to_element(id)) - mean[id.z()];
- *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = value;
+ *reinterpret_cast<float *>(tensor.ptr_to_element(id)) = value / std[id.z()];
});
return true;
@@ -330,6 +332,7 @@ bool NumPyBinLoader::access_tensor(ITensor &tensor)
// Validate tensor shape
ARM_COMPUTE_ERROR_ON_MSG(shape.size() != tensor_shape.num_dimensions(), "Tensor ranks mismatch");
+
if(fortran_order)
{
for(size_t i = 0; i < shape.size(); ++i)