ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
Dropout.hxx
Go to the documentation of this file.
1
// @(#)root/tmva/tmva/dnn:$Id$
2
// Author: Simon Pfreundschuh 10/07/16
3
4
/*************************************************************************
5
* Copyright (C) 2016, Simon Pfreundschuh *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
//////////////////////////////////////////////////////////////////
13
// Implementation of the activation functions for the reference //
14
// implementation. //
15
//////////////////////////////////////////////////////////////////
16
17
18
#include "
TMVA/DNN/Architectures/Reference.h
"
19
#include "
TRandom.h
"
20
21
namespace
TMVA
22
{
23
namespace
DNN
24
{
25
26
//______________________________________________________________________________
27
28
template
<
typename
Real_t>
29
void
TReference<Real_t>::DropoutForward
(
TReference<Real_t>::Tensor_t
& A,
TDescriptors
*,
TWorkspace
*,
Real_t
dropoutProbability)
30
{
31
size_t
m
,
n
;
32
m
= A.GetNrows();
33
n
= A.GetNcols();
34
35
for
(
size_t
i = 0; i <
m
; i++) {
36
for
(
size_t
j = 0; j <
n
; j++) {
37
Real_t
r
=
gRandom
->Uniform();
38
if
(
r
>= dropoutProbability) {
39
A(i,j) = 0.0;
40
}
else
{
41
A(i,j) /= dropoutProbability;
42
}
43
}
44
}
45
}
46
47
}
48
}
r
ROOT::R::TRInterface & r
Definition
Object.C:4
Reference.h
Real_t
float Real_t
TVector and TMatrix element type (float).
Definition
RtypesCore.h:82
TRandom.h
gRandom
externTRandom * gRandom
Definition
TRandom.h:62
TMVA::DNN::TReference::Tensor_t
TMatrixT< AReal > Tensor_t
Definition
Reference.h:59
TMVA::DNN::TReference::DropoutForward
static void DropoutForward(Tensor_t &A, TDescriptors *descriptors, TWorkspace *workspace, Scalar_t p)
Apply dropout with activation probability p to the given matrix A and scale the result by reciprocal ...
n
const Int_t n
Definition
legend1.C:16
TMVA::DNN
Definition
Adadelta.h:36
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
TMVA::DNN::TDescriptors
Definition
ContextHandles.h:29
TMVA::DNN::TWorkspace
Definition
ContextHandles.h:32
m
TMarker m
Definition
textangle.C:8
tmva
tmva
src
DNN
Architectures
Reference
Dropout.hxx
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1