Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
24namespace TMVA
25{
26namespace DNN
27{
28
30 virtual ~TDescriptors() {}
31};
32struct TWorkspace {
33 virtual ~TWorkspace() {}
34};
35
36template <typename Layer_t>
38 using HelperDescriptor_t = typename Layer_t::HelperDescriptor_t;
39
41};
42
43namespace CNN {
44
45//______________________________________________________________________________
46//
47// Keeps the descriptors for the CNN
48//______________________________________________________________________________
49
50template <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
61template <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
80
81 void *fReductionWorkspace = nullptr;
82
87
89};
90
91} // namespace CNN
92
93namespace RNN {
94template <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
115template <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
create variable transformations
typename Layer_t::WeightsDescriptor_t WeightsDescriptor_t
The weights that are modified (e.g filters)
typename Layer_t::HelperDescriptor_t HelperDescriptor_t
Used to define possible helpers for the layers (e.g. activations)
HelperDescriptor_t HelperDescriptor
WeightsDescriptor_t WeightsDescriptor
typename Layer_t::LayerDescriptor_t LayerDescriptor_t
Main layer operation.
typename Layer_t::AlgorithmForward_t AlgorithmForward_t
Forward layer operation.
AlgorithmBackward_t AlgorithmBackward
AlgorithmForward_t AlgorithmForward
typename Layer_t::AlgorithmBackward_t AlgorithmBackward_t
Backward layer operation.
AlgorithmHelper_t HelperAlgorithm
typename Layer_t::ReduceTensorDescriptor_t ReduceTensorDescriptor_t
AlgorithmDataType_t DataType
ReduceTensorDescriptor_t fReduceTensorDesc
typename Layer_t::AlgorithmDataType_t AlgorithmDataType_t
typename Layer_t::AlgorithmHelper_t AlgorithmHelper_t
Used for weight grad backward pass.
WeightsDescriptor_t WeightsGradDescriptor
typename Architecture_t::DropoutDescriptor_t HelperDescriptor_t
use for dropout
std::vector< TensorDescriptor_t > dyDesc
HelperDescriptor_t HelperDescriptor
typename Architecture_t::TensorDescriptor_t TensorDescriptor_t
the vector of tensor descriptors
WeightsDescriptor_t WeightsDescriptor
std::vector< TensorDescriptor_t > dxDesc
typename Architecture_t::RecurrentDescriptor_t LayerDescriptor_t
Main layer operation.
std::vector< TensorDescriptor_t > xDesc
typename Architecture_t::FilterDescriptor_t WeightsDescriptor_t
The weights that are modified (e.g filters)
std::vector< TensorDescriptor_t > yDesc
HelperDescriptor_t HelperDescriptor
typename Layer_t::HelperDescriptor_t HelperDescriptor_t