Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Dropout.cu
Go to the documentation of this file.
1// @(#)root/tmva/tmva/dnn:$Id$
2// Author: Simon Pfreundschuh 14/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
14#include "Kernels.cuh"
15
16/////////////////////////////////////////////////////////////////////
17// Implementation of the Dropout function for TCuda architectures. //
18/////////////////////////////////////////////////////////////////////
19
20namespace TMVA {
21namespace DNN {
22
23//____________________________________________________________________________
24template<typename AFloat>
25void TCuda<AFloat>::DropoutForward(TCudaTensor<AFloat> & A,
26 TDescriptors * /*descriptors*/,
27 TWorkspace * /*workspace*/,
28 AFloat dropoutProbability)
29{
30 dim3 blockDims = TDevice::BlockDims2D();
31 dim3 gridDims = TDevice::GridDims2D(A);
32 cudaStream_t s = A.GetComputeStream();
33 ::TMVA::DNN::Cuda::Dropout<<<gridDims, blockDims, 0, s>>>(
34 A.GetDataPointer(),
35 (int) A.GetNrows(),
36 (int) A.GetNcols(),
37 dropoutProbability,
39}
40
41} // namespace DNN
42} // namespace TMVA
static curandState_t * GetCurandStatesPointer()
Definition CudaMatrix.h:152
static void DropoutForward(Tensor_t &A, TDescriptors *descriptors, TWorkspace *workspace, Scalar_t p)
Apply dropout with activation probability p to the given tensor A and scale the result by reciprocal ...
static dim3 BlockDims2D()
Definition Device.h:55
static dim3 GridDims2D(int nrows, int ncols)
Definition Device.h:74
create variable transformations