Compute Library
 23.05
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 56 of file Utils.h.

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

Referenced by arm_compute::test::construct_dims_state().

57 {
58  static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
59  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;
60 
61  DistributionType distribution{ T(-1.0f), T(1.0f) };
62  library->fill(tensor, distribution, seed);
63 
64  // Fill border with infinity in order to check the presence of NaN values (i.e. inf * 0)
65  DistributionType distribution_inf{ T(std::numeric_limits<float>::infinity()), T(std::numeric_limits<float>::infinity()) };
66  library->fill_borders_with_garbage(tensor, distribution_inf, seed);
67 }
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)
CLTensor * tensor
Pointer to the auxiliary tensor.