Logo ROOT  
Reference Guide
ContextHandles.h
Go to the documentation of this file.
1 // @(#)root/tmva/tmva/dnn:$Id$
2 // Author: Simon Pfreundschuh 20/06/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 // Contains function enums for activation and output functions, as //
14 // well as generic evaluation functions, that delegate the call to //
15 // the corresponding evaluation kernel. //
16 /////////////////////////////////////////////////////////////////////
17 
18 #ifndef TMVA_DNN_CNN_DESCRIPTORS
19 #define TMVA_DNN_CNN_DESCRIPTORS
20 
21 #include <stddef.h>
22 #include <vector>
23 
24 namespace TMVA
25 {
26 namespace DNN
27 {
28 
29 struct TDescriptors {
30  virtual ~TDescriptors() {}
31 };
32 struct TWorkspace {
33  virtual ~TWorkspace() {}
34 };
35 
36 template <typename Layer_t>
38  using HelperDescriptor_t = typename Layer_t::HelperDescriptor_t;
39 
41 };
42 
43 namespace CNN {
44 
45 //______________________________________________________________________________
46 //
47 // Keeps the descriptors for the CNN
48 //______________________________________________________________________________
49 
50 template <typename Layer_t>
52  using LayerDescriptor_t = typename Layer_t::LayerDescriptor_t; // Main layer operation
53  using HelperDescriptor_t = typename Layer_t::HelperDescriptor_t; // Used to define possible helpers for the layers (e.g. activations)
54  using WeightsDescriptor_t = typename Layer_t::WeightsDescriptor_t; // The weights that are modified (e.g filters)
55 
59 };
60 
61 template <typename Layer_t>
63  using AlgorithmForward_t = typename Layer_t::AlgorithmForward_t; // Forward layer operation
64  using AlgorithmBackward_t = typename Layer_t::AlgorithmBackward_t; // Backward layer operation
65  using AlgorithmHelper_t = typename Layer_t::AlgorithmHelper_t; // Used for weight grad backward pass
66 
67  using ReduceTensorDescriptor_t = typename Layer_t::ReduceTensorDescriptor_t;
68 
69  using AlgorithmDataType_t = typename Layer_t::AlgorithmDataType_t;
70 
74 
76 
79  size_t *HelperWorkspace;
80 
81  void *fReductionWorkspace = nullptr;
82 
87 
89 };
90 
91 } // namespace CNN
92 
93 namespace RNN {
94 template <typename Architecture_t>
96 
97  using LayerDescriptor_t = typename Architecture_t::RecurrentDescriptor_t; // Main layer operation
98  using WeightsDescriptor_t = typename Architecture_t::FilterDescriptor_t; // The weights that are modified (e.g filters)
99  using TensorDescriptor_t = typename Architecture_t::TensorDescriptor_t; // the vector of tensor descriptors
100  using HelperDescriptor_t = typename Architecture_t::DropoutDescriptor_t; // use for dropout
101 
106 
107  // for RNN need 4 vectors of tensor descriptors
108 
109  std::vector<TensorDescriptor_t> xDesc;
110  std::vector<TensorDescriptor_t> yDesc;
111  std::vector<TensorDescriptor_t> dxDesc;
112  std::vector<TensorDescriptor_t> dyDesc;
113 };
114 
115 template <typename Layer_t>
117 
118  void *ForwardWorkspace = nullptr;
119  void *HelperWorkspace = nullptr;
120 
121 
124 };
125 
126 } // end namespace RNN
127 
128 
129 } // namespace DNN
130 } // namespace TMVA
131 
132 #endif
TMVA::DNN::CNN::TCNNWorkspace::BackwardWorkspace
size_t * BackwardWorkspace
Definition: ContextHandles.h:78
TMVA::DNN::RNN::TRNNDescriptors::WeightsGradDescriptor
WeightsDescriptor_t WeightsGradDescriptor
Definition: ContextHandles.h:104
TMVA::DNN::RNN::TRNNDescriptors::dyDesc
std::vector< TensorDescriptor_t > dyDesc
Definition: ContextHandles.h:112
TMVA::DNN::CNN::TCNNDescriptors::LayerDescriptor_t
typename Layer_t::LayerDescriptor_t LayerDescriptor_t
Definition: ContextHandles.h:52
TMVA::DNN::CNN::TCNNWorkspace::HelperAlgorithm
AlgorithmHelper_t HelperAlgorithm
Definition: ContextHandles.h:73
TMVA::DNN::CNN::TCNNWorkspace
Definition: ContextHandles.h:62
TMVA::DNN::CNN::TCNNDescriptors::HelperDescriptor
HelperDescriptor_t HelperDescriptor
Definition: ContextHandles.h:57
TMVA::DNN::RNN::TRNNDescriptors::WeightsDescriptor
WeightsDescriptor_t WeightsDescriptor
Definition: ContextHandles.h:103
TMVA::DNN::TDNNGenDescriptors
Definition: ContextHandles.h:37
TMVA::DNN::TWorkspace::~TWorkspace
virtual ~TWorkspace()
Definition: ContextHandles.h:33
TMVA::DNN::TDNNGenDescriptors::HelperDescriptor
HelperDescriptor_t HelperDescriptor
Definition: ContextHandles.h:40
TMVA::DNN::CNN::TCNNWorkspace::fReductionWorkspaceSize
size_t fReductionWorkspaceSize
Definition: ContextHandles.h:86
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmBackward
AlgorithmBackward_t AlgorithmBackward
Definition: ContextHandles.h:72
TMVA::DNN::RNN::TRNNDescriptors::HelperDescriptor_t
typename Architecture_t::DropoutDescriptor_t HelperDescriptor_t
Definition: ContextHandles.h:100
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmForward_t
typename Layer_t::AlgorithmForward_t AlgorithmForward_t
Definition: ContextHandles.h:63
TMVA::DNN::CNN::TCNNDescriptors::WeightsDescriptor
WeightsDescriptor_t WeightsDescriptor
Definition: ContextHandles.h:58
TMVA::DNN::CNN::TCNNWorkspace::HelperWorkspace
size_t * HelperWorkspace
Definition: ContextHandles.h:79
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmHelper_t
typename Layer_t::AlgorithmHelper_t AlgorithmHelper_t
Definition: ContextHandles.h:65
TMVA::DNN::RNN::TRNNDescriptors
Definition: ContextHandles.h:95
TMVA::DNN::RNN::TRNNWorkspace::HelperWorkspace
void * HelperWorkspace
Definition: ContextHandles.h:119
TMVA::DNN::CNN::TCNNWorkspace::fReductionWorkspace
void * fReductionWorkspace
Definition: ContextHandles.h:81
TMVA::DNN::CNN::TCNNDescriptors
Definition: ContextHandles.h:51
TMVA::DNN::TDescriptors::~TDescriptors
virtual ~TDescriptors()
Definition: ContextHandles.h:30
TMVA::DNN::CNN::TCNNWorkspace::ReduceTensorDescriptor_t
typename Layer_t::ReduceTensorDescriptor_t ReduceTensorDescriptor_t
Definition: ContextHandles.h:67
TMVA::DNN::RNN::TRNNWorkspace::HelperWorkspaceSize
size_t HelperWorkspaceSize
Definition: ContextHandles.h:123
TMVA::DNN::RNN::TRNNDescriptors::TensorDescriptor_t
typename Architecture_t::TensorDescriptor_t TensorDescriptor_t
Definition: ContextHandles.h:99
TMVA::DNN::CNN::TCNNDescriptors::HelperDescriptor_t
typename Layer_t::HelperDescriptor_t HelperDescriptor_t
Definition: ContextHandles.h:53
TMVA::DNN::RNN::TRNNDescriptors::yDesc
std::vector< TensorDescriptor_t > yDesc
Definition: ContextHandles.h:110
TMVA::DNN::CNN::TCNNWorkspace::ForwardWorkspace
size_t * ForwardWorkspace
Definition: ContextHandles.h:77
TMVA::DNN::TWorkspace
Definition: ContextHandles.h:32
TMVA::DNN::RNN::TRNNDescriptors::xDesc
std::vector< TensorDescriptor_t > xDesc
Definition: ContextHandles.h:109
TMVA::DNN::RNN::TRNNDescriptors::dxDesc
std::vector< TensorDescriptor_t > dxDesc
Definition: ContextHandles.h:111
TMVA::DNN::CNN::TCNNDescriptors::LayerDescriptor
LayerDescriptor_t LayerDescriptor
Definition: ContextHandles.h:56
TMVA::DNN::CNN::TCNNWorkspace::fReduceTensorDesc
ReduceTensorDescriptor_t fReduceTensorDesc
Definition: ContextHandles.h:88
TMVA::DNN::RNN::TRNNDescriptors::HelperDescriptor
HelperDescriptor_t HelperDescriptor
Definition: ContextHandles.h:105
TMVA::DNN::RNN::TRNNWorkspace
Definition: ContextHandles.h:116
TMVA::DNN::RNN::TRNNDescriptors::LayerDescriptor_t
typename Architecture_t::RecurrentDescriptor_t LayerDescriptor_t
Definition: ContextHandles.h:97
TMVA::DNN::TDescriptors
Definition: ContextHandles.h:29
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmDataType_t
typename Layer_t::AlgorithmDataType_t AlgorithmDataType_t
Definition: ContextHandles.h:69
TMVA::DNN::RNN::TRNNDescriptors::WeightsDescriptor_t
typename Architecture_t::FilterDescriptor_t WeightsDescriptor_t
Definition: ContextHandles.h:98
TMVA::DNN::RNN::TRNNWorkspace::ForwardWorkspaceSize
size_t ForwardWorkspaceSize
Definition: ContextHandles.h:122
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmBackward_t
typename Layer_t::AlgorithmBackward_t AlgorithmBackward_t
Definition: ContextHandles.h:64
TMVA::DNN::CNN::TCNNWorkspace::HelperWorkspaceSize
size_t HelperWorkspaceSize
Definition: ContextHandles.h:85
TMVA::DNN::RNN::TRNNWorkspace::ForwardWorkspace
void * ForwardWorkspace
Definition: ContextHandles.h:118
TMVA::DNN::CNN::TCNNDescriptors::WeightsDescriptor_t
typename Layer_t::WeightsDescriptor_t WeightsDescriptor_t
Definition: ContextHandles.h:54
TMVA::DNN::CNN::TCNNWorkspace::DataType
AlgorithmDataType_t DataType
Definition: ContextHandles.h:75
TMVA::DNN::RNN::TRNNDescriptors::LayerDescriptor
LayerDescriptor_t LayerDescriptor
Definition: ContextHandles.h:102
TMVA::DNN::TDNNGenDescriptors::HelperDescriptor_t
typename Layer_t::HelperDescriptor_t HelperDescriptor_t
Definition: ContextHandles.h:38
TMVA::DNN::CNN::TCNNWorkspace::BackwardWorkspaceSize
size_t BackwardWorkspaceSize
Definition: ContextHandles.h:84
TMVA::DNN::CNN::TCNNWorkspace::ForwardWorkspaceSize
size_t ForwardWorkspaceSize
Definition: ContextHandles.h:83
TMVA::DNN::CNN::TCNNWorkspace::AlgorithmForward
AlgorithmForward_t AlgorithmForward
Definition: ContextHandles.h:71
TMVA
create variable transformations
Definition: GeneticMinimizer.h:22