diff options
Diffstat (limited to 'tests/validation/fixtures/LSTMLayerFixture.h')
-rw-r--r-- | tests/validation/fixtures/LSTMLayerFixture.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/validation/fixtures/LSTMLayerFixture.h b/tests/validation/fixtures/LSTMLayerFixture.h index bf785bbdcd..2b321f5405 100644 --- a/tests/validation/fixtures/LSTMLayerFixture.h +++ b/tests/validation/fixtures/LSTMLayerFixture.h @@ -61,13 +61,19 @@ protected: template <typename U> void fill(U &&tensor, int i) { - std::uniform_real_distribution<> distribution(-1.0f, 1.0f); + static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported."); + using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_fp16, std::uniform_real_distribution<T>>::type; + + DistributionType distribution{ T(-1.0f), T(1.0f) }; library->fill(tensor, distribution, i); } template <typename U> void fill_custom_val(U &&tensor, float num, int i) { - std::uniform_real_distribution<> distribution(num, num); + static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported."); + using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_fp16, std::uniform_real_distribution<T>>::type; + + DistributionType distribution{ T(num), T(num) }; library->fill(tensor, distribution, i); } TensorType compute_target(const TensorShape &input_shape, const TensorShape &input_weights_shape, const TensorShape &recurrent_weights_shape, const TensorShape &cell_bias_shape, |