23template<
typename AFloat>
25 AFloat dropoutProbability)
27 AFloat *
data =
A.GetRawDataPointer();
30 size_t seed = dlRand.
Integer(4294967295);
32 size_t nElements =
A.GetNoElements();
35 auto f = [&
data, dropoutProbability, &nSteps, &nElements, &seed](
UInt_t workerID)
38 size_t iMax = std::min(workerID+nSteps,nElements);
39 for (
size_t i = workerID; i < iMax; ++i) {
41 data[i] = (
r > dropoutProbability) ? 0.0 :
data[i] / dropoutProbability;
47 A.GetThreadExecutor().Foreach(
f,
ROOT::TSeqI(0,nElements,nSteps));
49 for (
size_t i = 0; i < nElements; i+=nSteps)
56template<
typename AFloat>
58 AFloat dropoutProbability)
60 AFloat *
data =
A.GetRawDataPointer();
62 auto f = [&
data, dropoutProbability](
UInt_t workerID)
64 TRandom rand(time(
nullptr) + workerID);
65 AFloat
r = rand.Uniform();
66 data[workerID] = (
r > dropoutProbability) ? 0.0 :
data[workerID] / dropoutProbability;
A pseudo container class which is a generator of indices.
static size_t GetNWorkItems(size_t nelements)
static void Dropout(TCpuMatrix< Scalar_t > &A, Scalar_t p)
Apply dropout with activation probability p to the given matrix A and scale the result by reciprocal ...
static TRandom & GetRandomGenerator()
This is the base class for the ROOT Random number generators.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual UInt_t Integer(UInt_t imax)
Returns a random integer on [ 0, imax-1 ].
Abstract ClassifierFactory template that handles arbitrary types.