26 using dropout_distribution = std::conditional_t<std::is_floating_point_v<T>, std::uniform_real_distribution<T>, std::uniform_int_distribution<T>>;
31 template <
typename T =
double>
43 (is_single_precision_t<T> && impl::egblas::has_sdropout_seed) || (is_double_precision_t<T> && impl::egblas::has_ddropout_seed);
71 std::uniform_int_distribution<long> seed_dist;
76 impl::egblas::dropout_seed(
etl::size(y), probability, alpha, t1.gpu_memory(), 1, seed_dist(rand_engine));
88 std::uniform_int_distribution<long> seed_dist;
91 impl::egblas::dropout_seed(
etl::size(y), probability, alpha, y.gpu_memory(), 1, seed_dist(rand_engine));
113 template <
typename G,
typename T =
double>
124 static constexpr
bool gpu_computable =
125 (is_single_precision_t<T> && impl::egblas::has_sdropout_seed) || (is_double_precision_t<T> && impl::egblas::has_ddropout_seed);
153 template <
typename Y>
155 std::uniform_int_distribution<long> seed_dist;
160 impl::egblas::dropout_seed(
etl::size(y), probability, alpha, t1.gpu_memory(), 1, seed_dist(rand_engine));
170 template <
typename Y>
172 std::uniform_int_distribution<long> seed_dist;
175 impl::egblas::dropout_seed(
etl::size(y), probability, alpha, y.gpu_memory(), 1, seed_dist(rand_engine));
auto s(T &&value)
Force the evaluation of the given expression.
Definition: stop.hpp:18
G & rand_engine
The random engine.
Definition: dropout_mask.hpp:118
EGBLAS wrappers for the dropout operation.
friend std::ostream & operator<<(std::ostream &os, const dropout_mask_generator_op &s)
Outputs the given generator to the given stream.
Definition: dropout_mask.hpp:105
Y & gpu_compute(Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: dropout_mask.hpp:171
static constexpr bool gpu_computable
Indicates if the operator can be computed on GPU.
Definition: dropout_mask.hpp:42
friend std::ostream & operator<<(std::ostream &os, const dropout_mask_generator_g_op &s)
Outputs the given generator to the given stream.
Definition: dropout_mask.hpp:189
dropout_mask_generator_g_op(G &g, T probability)
Construct a new generator with the given start and end of the range.
Definition: dropout_mask.hpp:132
value_type operator()()
Generate a new value.
Definition: dropout_mask.hpp:54
std::conditional_t< std::is_floating_point_v< T >, std::uniform_real_distribution< T >, std::uniform_int_distribution< T > > dropout_distribution
Selector helper to get an dropout_distribution based on the type (real or int)
Definition: dropout_mask.hpp:26
Root namespace for the ETL library.
Definition: adapter.hpp:15
T value_type
The value type.
Definition: dropout_mask.hpp:115
dropout_distribution< value_type > distribution
The used distribution.
Definition: dropout_mask.hpp:37
auto gpu_compute_hint(Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: dropout_mask.hpp:70
decltype(auto) force_temporary_gpu_dim_only(E &&expr)
Force a temporary out of the expression, without copying its content.
Definition: temporary.hpp:223
Generator from an uniform distribution using a custom random engine.
Definition: dropout_mask.hpp:114
constexpr size_t size(const E &expr) noexcept
Returns the size of the given ETL expression.
Definition: helpers.hpp:108
random_engine rand_engine
The random engine.
Definition: dropout_mask.hpp:36
const T probability
The dropout probability.
Definition: dropout_mask.hpp:117
auto gpu_compute_hint(Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: dropout_mask.hpp:154
value_type operator()()
Generate a new value.
Definition: dropout_mask.hpp:138
std::mt19937_64 random_engine
The random engine used by the library.
Definition: random.hpp:22
const T probability
The dropout probability.
Definition: dropout_mask.hpp:35
Y & gpu_compute(Y &y) noexcept
Compute the result of the operation using the GPU.
Definition: dropout_mask.hpp:87
Generator from an uniform distribution.
Definition: dropout_mask.hpp:32
dropout_mask_generator_op(T probability)
Construct a new generator with the given start and end of the range.
Definition: dropout_mask.hpp:48
dropout_distribution< value_type > distribution
The used distribution.
Definition: dropout_mask.hpp:119
T value_type
The value type.
Definition: dropout_mask.hpp:33