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 TensorDescriptor_t = typename Architecture_t::TensorDescriptor_t; ///< the vector of tensor descriptors
99 using HelperDescriptor_t = typename Architecture_t::DropoutDescriptor_t; ///< use for dropout
100
103
104#if (CUDNN_VERSION >= 8000)
105 //using WeightsDescriptor_t = typename Architecture_t::TensorDescriptor_t;
106 using DataDescriptor_t = typename Architecture_t::RNNDataDescriptor_t; ///< the vector of tensor descriptors
107
108 DataDescriptor_t xDataDesc; // input data descriptor
109 DataDescriptor_t yDataDesc; // output data descriptor
110
111#else
112 using WeightsDescriptor_t = typename Architecture_t::FilterDescriptor_t; ///< The weights that are modified (e.g filters)
113 using DataDescriptor_t = typename Architecture_t::TensorDescriptor_t; ///< the vector of tensor descriptors
114
115
118
119
120 // for RNN need 4 vectors of tensor descriptors
121
122 std::vector<TensorDescriptor_t> xDesc;
123 std::vector<TensorDescriptor_t> yDesc;
124 std::vector<TensorDescriptor_t> dxDesc;
125 std::vector<TensorDescriptor_t> dyDesc;
126
127#endif
128
129};
130
131template <typename Layer_t>
133
134 void *ForwardWorkspace = nullptr;
135 void *InferenceWorkspace = nullptr;
136 void *HelperWorkspace = nullptr;
137
138
142};
143
144} // end namespace RNN
145
146
147} // namespace DNN
148} // namespace TMVA
149
150#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
typename Architecture_t::TensorDescriptor_t DataDescriptor_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