diff options
author | John Richardson <john.richardson@arm.com> | 2017-10-12 12:15:23 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | 66bd42adfa57b5f3148e87525da721fbf47da910 (patch) | |
tree | 4c23ecebec05d11a510b79fd76a4a27e8e86f8fe /tests | |
parent | 7631021dcfd4772c3cc315f8b3256f1ed125c5af (diff) | |
download | ComputeLibrary-66bd42adfa57b5f3148e87525da721fbf47da910.tar.gz |
COMPMID-620: Throw a FileNotFound error when FixedPoint npy files are missing
Change-Id: I511c303c9412619b5b43931b2571805854bffee3
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/91528
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/validation/UNIT/FixedPoint.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/tests/validation/UNIT/FixedPoint.cpp b/tests/validation/UNIT/FixedPoint.cpp index 627a779f5f..66a4b25fc9 100644 --- a/tests/validation/UNIT/FixedPoint.cpp +++ b/tests/validation/UNIT/FixedPoint.cpp @@ -44,6 +44,19 @@ const auto FuncNamesDataset = framework::dataset::make("FunctionNames", { FixedP FixedPointOp::LOG, FixedPointOp::INV_SQRT }); + +template <typename T> +void load_array_from_numpy(const std::string &file, std::vector<unsigned long> &shape, std::vector<T> &data) // NOLINT +{ + try + { + npy::LoadArrayFromNumpy(file, shape, data); + } + catch(const std::runtime_error &e) + { + throw framework::FileNotFound("Could not load npy file: " + file + " (" + e.what() + ")"); + } +} } // namespace TEST_SUITE(UNIT) @@ -71,8 +84,7 @@ DATA_TEST_CASE(FixedPointQS8Inputs, framework::DatasetMode::ALL, combine( + support::cpp11::to_string(frac_bits) + ".in.npy"; - ARM_COMPUTE_TEST_INFO(inputs_file); - npy::LoadArrayFromNumpy(inputs_file, shape, data); + load_array_from_numpy(inputs_file, shape, data); // Values stored as doubles so reinterpret as floats const auto *float_val = reinterpret_cast<float *>(&data[0]); @@ -126,11 +138,8 @@ DATA_TEST_CASE(FixedPointQS8Outputs, framework::DatasetMode::ALL, zip(combine( const std::string inputs_file = base_file_name + ".in.npy"; const std::string reference_file = base_file_name + ".out.npy"; - ARM_COMPUTE_TEST_INFO(base_file_name + ".in"); - npy::LoadArrayFromNumpy(inputs_file, in_shape, in_data); - - ARM_COMPUTE_TEST_INFO(base_file_name + ".out"); - npy::LoadArrayFromNumpy(reference_file, out_shape, out_data); + load_array_from_numpy(inputs_file, in_shape, in_data); + load_array_from_numpy(reference_file, out_shape, out_data); ARM_COMPUTE_EXPECT(in_shape.front() == out_shape.front(), framework::LogLevel::ERRORS); |