Logo ROOT   6.10/09
Reference Guide
TestActivationFunctionsCuda.cxx
Go to the documentation of this file.
1 // @(#)root/tmva/tmva/test/dnn $Id$
2 // Author: Simon Pfreundschuh
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 // Concrete instantiation of the generic activation function test //
14 // for the TCuda implementation. //
15 //////////////////////////////////////////////////////////////////////
16 
17 #include <iostream>
19 #include "Utility.h"
21 
22 using namespace TMVA::DNN;
23 
24 int main()
25 {
26  using Scalar_t = Double_t;
27 
28  std::cout << "Testing Activation Functions:" << std::endl;
29 
30  double error;
31 
32  // Identity.
33 
34  error = testIdentity<TCuda<Scalar_t>>(10);
35  std::cout << "Testing identity activation: ";
36  std::cout << "maximum relative error = " << error << std::endl;
37  if (error > 1e-5)
38  return 1;
39 
40  error = testIdentityDerivative<TCuda<Scalar_t>>(10);
41  std::cout << "Testing identity activation derivative: ";
42  std::cout << "maximum relative error = " << error << std::endl;
43  if (error > 1e-5)
44  return 1;
45 
46  // ReLU.
47 
48  error = testRelu<TCuda<Scalar_t>>(10);
49  std::cout << "Testing ReLU activation: ";
50  std::cout << "maximum relative error = " << error << std::endl;
51  if (error > 1e-5)
52  return 1;
53 
54  error = testReluDerivative<TCuda<Scalar_t>>(10);
55  std::cout << "Testing ReLU activation derivative: ";
56  std::cout << "maximum relative error = " << error << std::endl;
57  if (error > 1e-5)
58  return 1;
59 
60  // Sigmoid.
61 
62  error = testSigmoid<TCuda<Scalar_t>>(10);
63  std::cout << "Testing Sigmoid activation: ";
64  std::cout << "maximum relative error = " << error << std::endl;
65  if (error > 1e-5)
66  return 1;
67 
68  error = testSigmoidDerivative<TCuda<Scalar_t>>(10);
69  std::cout << "Testing Sigmoid activation derivative: ";
70  std::cout << "maximum relative error = " << error << std::endl;
71  if (error > 1e-5)
72  return 1;
73  return 0;
74 }
Definition: Blas.h:58
double Double_t
Definition: RtypesCore.h:55
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630