Compute Library
 22.08
arm_compute::test::validation::utils Namespace Reference

Functions

template<typename T , typename U >
void fill (U &&tensor, int seed, AssetsLibrary *library)
 

Function Documentation

◆ fill()

void arm_compute::test::validation::utils::fill ( U &&  tensor,
int  seed,
AssetsLibrary library 
)

Definition at line 55 of file Utils.h.

References arm_compute::test::validation::distribution(), AssetsLibrary::fill(), AssetsLibrary::fill_borders_with_garbage(), and type.

Referenced by TensorShape::collapse(), Dimensions< size_t >::collapse(), arm_compute::test::construct_dims_state(), arm_compute::test::validation::get_tile(), Dimensions< size_t >::remove(), TensorShape::remove_dimension(), TensorShape::set(), Steps::Steps(), TensorShape::TensorShape(), and arm_compute::test::validation::zeros().

56 {
57  static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
58  using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<T>>::type;
59 
60  DistributionType distribution{ T(-1.0f), T(1.0f) };
61  library->fill(tensor, distribution, seed);
62 
63  // Fill border with infinity in order to check the presence of NaN values (i.e. inf * 0)
64  DistributionType distribution_inf{ T(std::numeric_limits<float>::infinity()), T(std::numeric_limits<float>::infinity()) };
65  library->fill_borders_with_garbage(tensor, distribution_inf, seed);
66 }
decltype(strategy::transforms) typedef type
Specialized class to generate random non-zero FP16 values.
Definition: Utils.h:254
std::unique_ptr< AssetsLibrary > library
Definition: main.cpp:76
std::uniform_real_distribution< float > distribution(-5.f, 5.f)