Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
ROperator_Pool.hxx
Go to the documentation of this file.
1#ifndef TMVA_SOFIE_ROPERATOR_POOL
2#define TMVA_SOFIE_ROPERATOR_POOL
3
5#include "TMVA/ROperator.hxx"
6#include "TMVA/RModel.hxx"
7
8#include <memory>
9#include <sstream>
10#include <algorithm>
11#include <stdexcept>
12#include <vector>
13#include <cassert>
14
15namespace TMVA {
16namespace Experimental {
17namespace SOFIE {
18
20 // structure that contains Pool attribute
21 std::string auto_pad = "NOTSET";
22 int ceil_mode = 0;
23 int count_include_pad = 0; // not for MaxPool
24 int storage_order = 0; // not for AveragePool
25 std::vector<size_t> dilations; // not for AveragePool
26 std::vector<size_t> kernel_shape;
27 std::vector<size_t> pads;
28 std::vector<size_t> strides;
29};
30
32
33template<typename T>
35{
36
37private:
38
40
44 std::string fAttrAutopad;
45 std::vector<size_t> fAttrDilations;
46 std::vector<size_t> fAttrKernelShape;
47 std::vector<size_t> fAttrPads;
48 std::vector<size_t> fAttrStrides;
49
50 std::string fNX;
51 std::string fNY;
52
53 std::vector<size_t> fShapeX;
54 std::vector<size_t> fShapeY;
55
56 std::string fType;
57
58 size_t fDim; // dimension of the MaxPool
59 bool fUseSession = false;
60
61public:
62
63 std::string Name() {
64 if (fPoolMode == AveragePool) return "AveragePool";
65 if (fPoolMode == MaxPool) return "MaxPool";
66 return "Invalid";
67 }
68
70
72 : fPoolMode(mode), fAttrCeilMode(attr.ceil_mode), fAttrCountIncludePad(attr.count_include_pad),
73 fAttrStorageOrder(attr.storage_order), fAttrAutopad(attr.auto_pad),
74 fAttrDilations(attr.dilations), fAttrKernelShape(attr.kernel_shape), fAttrPads(attr.pads), fAttrStrides(attr.strides),
75 fNX(UTILITY::Clean_name(nameX)), fNY(UTILITY::Clean_name(nameY))
76 {
77 if(std::is_same<T, float>::value) {
78 fType = "float";
79 } else {
80 throw
81 std::runtime_error("TMVA SOFIE Encountered unsupported type parsing a Pool operator");
82 }
85 }
86
87 // return input type (defined abstract in ROperator class )
88 std::vector<ETensorType> TypeInference(std::vector<ETensorType> input) override {
89 // only one input in Pool operators
90 return input;
91 }
92
93 // function returning output shape given input
94 std::vector<std::vector<size_t>> ShapeInference(std::vector<std::vector<size_t>> input) override {
95 // shape of pooling input has to be (according to ONNX): NxCxHxW
96 // Where N is batch size, C : input channels, H : input height, W = input width
97 // or it can be [N, C, F1,F2,....FN] . Minimum dimension is 3
98 if (input.size() != 1 ) {
99 throw std::runtime_error("TMVA SOFIE" + Name() + "Op Shape inference need 1 input tensor");
100 }
101 if (input[0].size() < 3) {
102 throw std::runtime_error("TMVA SOFIE" + Name() + "Op Shape inference only accept tensor with at least 3 dimensions");
103 }
104 // support only input tensors with dim = 3,4,5
105 if (input[0].size() < 3 || input[0].size() > 5) {
106 throw std::runtime_error("TMVA SOFIE" + Name() + "Op : tensors with dimension " + std::to_string(input[0].size()) + " are not yet supported");
107 }
108
109 if (input[0].size() -2 != fDim) {
110 throw
111 std::runtime_error("TMVA SOFIE Pool Op Shape inference - invalid inputs ");
112 }
113 // kernel shape
114 size_t k1 = ((fAttrKernelShape.empty())? input[0][2] : fAttrKernelShape[0]);
115 size_t k2 = (fDim > 1) ? ((fAttrKernelShape.empty()) ? input[0][3] : fAttrKernelShape[1]) : 1;
116 size_t k3 = (fDim > 2) ? ((fAttrKernelShape.empty()) ? input[0][4] : fAttrKernelShape[2]) : 1;
117
118
119 size_t i1 = (fDim > 1) ? ((fDim > 2) ? 3 : 2) : 1;
120 size_t i2 = (fDim > 2) ? 4 : 3;
121 size_t i3 = 5;
122
123 if (fAttrDilations.empty()) {
124 fAttrDilations = {1, 1, 1};
125 }
126 fAttrDilations.resize(3);
127 if (fDim < 3) {
128 fAttrDilations.resize(3, 1);
129 }
130 // Shape of the kernel
131 fAttrKernelShape = {k1 + (fAttrDilations[0] - 1) * (k1 - 1),
132 k2 + (fAttrDilations[1] - 1) * (k2 - 1),
133 k3 + (fAttrDilations[2] - 1) * (k3 - 1)};
134
135 if (fAttrAutopad == "NOTSET") {
136 // in auto_pad is NOTSET then fAttrPads should have been set or default zero is used
137 if (fAttrPads.empty()) {
138 fAttrPads = {0, 0, 0, 0, 0, 0};
139 }
140 } else if (fAttrAutopad == "SAME_UPPER" || fAttrAutopad == "SAME_LOWER") {
141 if (fDim == 1)
143 else if (fDim == 2)
145 else if (fDim == 3)
147 fAttrKernelShape[0] / 2, fAttrKernelShape[1] / 2, fAttrKernelShape[2] / 2};
148 // add extra padding at beginning or end (depending if SAME_UPPER or SAME_LOWER)
149 // need to check this!
150 if (fAttrKernelShape[0] % 2 == 1) {
151 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[0]++ : fAttrPads[i1]++;
152 }
153 if (fDim > 1 && fAttrKernelShape[1] % 2 == 1) {
154 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[1]++ : fAttrPads[i2]++;
155 }
156 if (fDim > 2 && fAttrKernelShape[2] % 2 == 1) {
157 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[2]++ : fAttrPads[i3]++;
158 }
159 } else if (fAttrAutopad != "VALID") {
160 throw
161 std::runtime_error("TMVA SOFIE" + Name() + "Op invalid Autopad value : " + fAttrAutopad);
162 }
163 // to be sure pad is vector of size 6
164 if (fDim < 3) fAttrPads.resize(6, 0);
165
166 if (fAttrStrides.empty()) {
167 fAttrStrides = {1, 1, 1};
168 }
169
170 if (fDim < 3)
171 fAttrStrides.resize(3, 1);
172
173 size_t input1 = input[0][2];
174 size_t input2 = (fDim > 1) ? input[0][3] : 1;
175 size_t input3 = (fDim > 2) ? input[0][4] : 1;
176
177 size_t pad1 = fAttrPads[0] + fAttrPads[i1];
178 size_t output1 = (input1 + pad1 - fAttrKernelShape[0]) / fAttrStrides[0] + 1;
179
180 size_t batch_size = input[0][0]; // first element in input tensor
181 size_t output_channels = input[0][1]; // first element in output tensor
182
183 std::vector<std::vector<size_t>> ret({{ batch_size, output_channels, output1 }});
184
185 if (fDim == 1)
186 return ret;
187
188 size_t pad2 = fAttrPads[1] + fAttrPads[i2];
189 size_t output2 = (input2 + pad2 - fAttrKernelShape[1]) / fAttrStrides[1] + 1;
190 // output is N x C x OH x OW
191 ret[0].push_back(output2);
192 if (fDim == 2)
193 return ret;
194
195 size_t pad3 = fAttrPads[2] + fAttrPads[i3];
196 size_t output3 = (input3 + pad3 - fAttrKernelShape[2] ) / fAttrStrides[2] + 1;
197
198 // output is N x C x OH x OW x OD
199 ret[0].push_back(output3);
200 return ret;
201 }
202
203 void Initialize(RModel& model) override {
204
205 fUseSession = model.UseSession();
206
207 if (!model.CheckIfTensorAlreadyExist(fNX)) {
208 throw
209 std::runtime_error("TMVA SOFIE Pool op Input Tensor " + fNX + " is not found in model");
210 }
211 fShapeX = model.GetTensorShape(fNX);
212 if (fShapeX.size() < 3 || fShapeX.size() > 5) {
213 std::cout << fNX << " : " << ConvertShapeToString(fShapeX) << std::endl;
214 throw
215 std::runtime_error("TMVA SOFIE Pool Op input data tensor" + fNX + " is not of 3,4 or 5 dimensions");
216 }
217 fDim = fShapeX.size() - 2;
218 // case of GlobalAveragePool. It is a pool case with kernel shape == image shape
221 fAttrKernelShape.resize(3);
223 if (fDim > 1)
225 if (fDim > 2)
227 fAttrAutopad = "VALID";
228 fAttrPads = {0, 0, 0, 0, 0, 0 };
229 assert(fAttrStrides.empty());
230 }
231 // find shape of Y and add it in the list of intermediate tensors
234
235 // need cmath for INFINITY when using MaxPool
236 if (fPoolMode == MaxPool) model.AddNeededStdLib("cmath");
237
238 }
239
240 std::string GenerateInitCode() override {
241 std::stringstream out;
242 return out.str();
243 }
244
245 // generate code for Session data members (e.g. internal vectors)
246 virtual std::string GenerateSessionMembersCode(std::string opName) override {
247 opName = "op_" + opName;
248 std::stringstream out;
249 // input matrix padded with zero
250 if(fDim == 1){
251 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
252 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) << ");\n";
253 }
254 else if(fDim == 2){
255 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
256 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3])
257 << ");\n";
258 }
259 else{ //dim is 3D
260 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
261 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3]) *
262 (fShapeX[4] + fAttrPads[2] + fAttrPads[4]) << ");\n";
263 }
264
265 return out.str();
266 }
267
268 std::string Generate(std::string OpName) override {
269 OpName = "op_" + OpName;
270
271 if (fShapeX.empty() || fShapeY.empty()) {
272 throw std::runtime_error("TMVA SOFIE Pool Op called to Generate without being initialized first");
273 }
274
275 std::stringstream out;
276
277 out << "\n//---- operator " << Name() << " " << OpName << "\n";
278 out << "{\n"; // create a new scope to avoid name clash
279
280 assert(fShapeX[0] == fShapeY[0]);
281 assert(fShapeX[1] == fShapeY[1]);
282 assert(fAttrPads.size() == 6);
283 assert(fAttrKernelShape.size() == 3);
284 // find lower bounds of filtered area
285 int hmin = - fAttrPads[0]; // minimum lower bound value of filter area
286 int hmax = fShapeX[2] + fAttrPads[1] - fAttrKernelShape[0] +1; // maximum lower bound value + 1
287 int wmin,wmax,dmin,dmax;
288
289 if(fDim >= 2){
290 wmin = - fAttrPads[2]; // minimum lower bound value of filter area
291 wmax = fShapeX[3] + fAttrPads[3] - fAttrKernelShape[1] +1; // maximum lower bound value + 1
292 }
293 else{
294 wmin=1;
295 wmax=1;
296 }
297 if(fDim == 3){
298 dmin = - fAttrPads[4]; // minimum lower bound value of filter area
299 dmax = fShapeX[4] + fAttrPads[5] - fAttrKernelShape[2] +1; // maximum lower bound value + 1
300 }
301 else{
302 dmin=1;
303 dmax=1;
304 }
305 out << SP << "constexpr int hsize = " << fShapeX[2] << ";\n";
306 out << SP << "constexpr int hmin = " << hmin << ";\n";
307 out << SP << "constexpr int hmax = " << hmax << ";\n";
308 out << SP << "constexpr int kh = " << fAttrKernelShape[0] << ";\n";
309 if (fDim > 1) {
310 size_t wsize = fShapeX[3];
311 out << SP << "constexpr int wsize = " << wsize << ";\n";
312 out << SP << "constexpr int wmin = " << wmin << ";\n";
313 out << SP << "constexpr int wmax = " << wmax << ";\n";
314 out << SP << "constexpr int kw = " << fAttrKernelShape[1] << ";\n";
315 if (fDim > 2) {
316 size_t dsize = fShapeX[4];
317 out << SP << "constexpr int dsize = " << dsize << ";\n";
318 out << SP << "constexpr int dwsize = " << dsize*wsize << ";\n"; // hstride
319 out << SP << "constexpr int dmin = " << dmin << ";\n";
320 out << SP << "constexpr int dmax = " << dmax << ";\n";
321 out << SP << "constexpr int kd = " << fAttrKernelShape[2] << ";\n";
322 }
323 }
324
325
326 bool doPadding = false;
327 for ( auto & e : fAttrPads)
328 doPadding |= (e > 0);
329
330
331 if(fDim==1){
332 // loop on batches and channels
333 out << SP << "size_t outIndex = 0;\n";
334 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
335 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2] << ";\n";
336 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
337 // loop on elements of filter region to compute maximum
338 if (fPoolMode == MaxPool)
339 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
340 else if (fPoolMode == AveragePool) {
341 out << SP << SP << SP << SP << "float value = 0;\n";
343 out << SP << SP << SP << SP << "int nsum = 0;\n";
344 else // in case we count the pad values in average
345 out << SP << SP << SP << SP << "constexpr int nsum = kh;\n";
346 }
347 // loop on rows of filtered region
348 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
349 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
350 out << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l;\n";
351 if (fPoolMode == MaxPool) {
352 out << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
353 out << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
354 }
355 else if (fPoolMode == AveragePool) {
356 // compute sum of values
357 out << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
359 // compute number of elements used for the average
360 out << SP << SP << SP << SP << SP << SP << "nsum++;\n";
361 }
362 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
363 if (fPoolMode == AveragePool) {
364 // compute average
365 out << SP << SP << SP << SP << "value /= float(nsum);\n";
366 }
367
368 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
369
370 out << SP << SP << "}\n"; // end loop on i (image rows)
371 out << SP << "}\n"; // end loop on c*b
372 }
373 else if(fDim==2){
374 // loop on batches and channels
375 out << SP << "size_t outIndex = 0;\n";
376 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
377 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3] << ";\n";
378 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
379 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
380 // loop on elements of filter region to compute maximum
381 if (fPoolMode == MaxPool)
382 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
383 else if (fPoolMode == AveragePool) {
384 out << SP << SP << SP << SP << "float value = 0;\n";
386 out << SP << SP << SP << SP << "int nsum = 0;\n";
387 else // in case we count the pad values in average
388 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh;\n";
389 }
390 // loop on rows of filtered region
391 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
392 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
393 // loop on columns of filtered region
394 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
395 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
396 out << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*wsize + m;\n";
397 if (fPoolMode == MaxPool) {
398 out << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
399 out << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
400 }
401 else if (fPoolMode == AveragePool) {
402 // compute sum of values
403 out << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
405 // compute number of elements used for the average
406 out << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
407 }
408 out << SP << SP << SP << SP << SP << SP << "}\n";
409 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
410 if (fPoolMode == AveragePool) {
411 // compute average
412 out << SP << SP << SP << SP << "value /= float(nsum);\n";
413 }
414 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
415 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
416 out << SP << SP << "}\n"; // end loop on i (image rows)
417 out << SP << "}\n"; // end loop on c*b
418 }
419 else if(fDim==3){
420 // loop on batches and channels
421 out << SP << "size_t outIndex = 0;\n";
422 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
423 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3]*fShapeX[4] << ";\n";
424 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
425 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
426 out << SP << SP << SP << SP << "for (int k = dmin; k < dmax; k+=" << fAttrStrides[2] << ") {\n";
427 // loop on elements of filter region to compute maximum
428 if (fPoolMode == MaxPool)
429 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
430 else if (fPoolMode == AveragePool) {
431 out << SP << SP << SP << SP << "float value = 0;\n";
433 out << SP << SP << SP << SP << "int nsum = 0;\n";
434 else // in case we count the pad values in average
435 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh*kd;\n";
436 }
437 // loop on rows of filtered region
438 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
439 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
440 // loop on columns of filtered region
441 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
442 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
443 // loop on layers of filtered region
444 out << SP << SP << SP << SP << SP << SP << "for (int p = k; p < k + kd; p++) {\n";
445 out << SP << SP << SP << SP << SP << SP << SP << "if (p < 0 || p >= dsize) continue;\n";
446 out << SP << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*dwsize + m*dsize + p;\n";
447
448 if (fPoolMode == MaxPool) {
449 out << SP << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
450 out << SP << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
451 }
452 else if (fPoolMode == AveragePool) {
453 // compute sum of values
454 out << SP << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
456 // compute number of elements used for the average
457 out << SP << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
458 }
459 out << SP << SP << SP << SP << SP << SP << "}\n";
460 out << SP << SP << SP << SP << SP << "}\n";
461 out << SP << SP << SP << SP << "}\n"; // end loop on region elements
462 if (fPoolMode == AveragePool) {
463 // compute average
464 out << SP << SP << SP << SP << "value /= float(nsum);\n";
465 }
466
467 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
468 out << SP << SP << SP << SP << "}\n" ; // end loop on k (layers of image)
469 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
470 out << SP << SP << "}\n"; // end loop on i (image rows)
471 out << SP << "}\n"; // end loop on c*b
472 }
473 // end scope
474 out << SP << "}\n";
475
476
477 return out.str();
478 }
479};
480
481} // namespace SOFIE
482} // namespace Experimental
483} // namespace TMVA
484
485
486#endif
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmax
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
void AddNeededStdLib(std::string libname)
const ETensorType & GetTensorType(std::string name)
Definition RModel.cxx:94
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
Definition RModel.cxx:227
bool CheckIfTensorAlreadyExist(std::string tensor_name)
Definition RModel.cxx:122
const std::vector< size_t > & GetTensorShape(std::string name)
Definition RModel.cxx:56
virtual std::string GenerateSessionMembersCode(std::string opName) override
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > > input) override
void Initialize(RModel &model) override
std::vector< ETensorType > TypeInference(std::vector< ETensorType > input) override
std::string Generate(std::string OpName) override
ROperator_Pool(PoolOpMode mode, RAttributes_Pool attr, std::string nameX, std::string nameY)
std::vector< std::string_view > fInputTensorNames
Definition ROperator.hxx:46
const std::string SP
space used to correctly indent the generated C++ code
Definition ROperator.hxx:42
std::vector< std::string_view > fOutputTensorNames
Definition ROperator.hxx:47
std::string ConvertShapeToString(std::vector< size_t > shape)
create variable transformations