Logo ROOT  
Reference Guide
 
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>
34class ROperator_Pool final : public ROperator
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
71 ROperator_Pool(PoolOpMode mode, RAttributes_Pool attr, std::string nameX, std::string nameY)
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 }
83 }
84
85 // return input type (defined abstract in ROperator class )
86 std::vector<ETensorType> TypeInference(std::vector<ETensorType> input) {
87 // only one input in Pool operators
88 return input;
89 }
90
91 // function returning output shape given input
92 std::vector<std::vector<size_t>> ShapeInference(std::vector<std::vector<size_t>> input) {
93 // shape of pooling input has to be (according to ONNX): NxCxHxW
94 // Where N is batch size, C : input channels, H : input height, W = input width
95 // or it can be [N, C, F1,F2,....FN] . Minimum dimension is 3
96 if (input.size() != 1 ) {
97 throw std::runtime_error("TMVA SOFIE" + Name() + "Op Shape inference need 1 input tensor");
98 }
99 if (input[0].size() < 3) {
100 throw std::runtime_error("TMVA SOFIE" + Name() + "Op Shape inference only accept tensor with at least 3 dimensions");
101 }
102 // support only input tensors with dim = 3,4,5
103 if (input[0].size() < 3 || input[0].size() > 5) {
104 throw std::runtime_error("TMVA SOFIE" + Name() + "Op : tensors with dimension " + std::to_string(input[0].size()) + " are not yet supported");
105 }
106
107 if (input[0].size() -2 != fDim) {
108 throw
109 std::runtime_error("TMVA SOFIE Pool Op Shape inference - invalid inputs ");
110 }
111 // kernel shape
112 size_t k1 = ((fAttrKernelShape.empty())? input[0][2] : fAttrKernelShape[0]);
113 size_t k2 = (fDim > 1) ? ((fAttrKernelShape.empty()) ? input[0][3] : fAttrKernelShape[1]) : 1;
114 size_t k3 = (fDim > 2) ? ((fAttrKernelShape.empty()) ? input[0][4] : fAttrKernelShape[2]) : 1;
115
116
117 size_t i1 = (fDim > 1) ? ((fDim > 2) ? 3 : 2) : 1;
118 size_t i2 = (fDim > 2) ? 4 : 3;
119 size_t i3 = 5;
120
121 if (fAttrDilations.empty()) {
122 fAttrDilations = {1, 1, 1};
123 }
124 fAttrDilations.resize(3);
125 if (fDim < 3) {
126 fAttrDilations.resize(3, 1);
127 }
128 // Shape of the kernel
129 fAttrKernelShape = {k1 + (fAttrDilations[0] - 1) * (k1 - 1),
130 k2 + (fAttrDilations[1] - 1) * (k2 - 1),
131 k3 + (fAttrDilations[2] - 1) * (k3 - 1)};
132
133 if (fAttrAutopad == "NOTSET") {
134 if (fAttrPads.empty()) {
135 fAttrPads = {1, 1, 1, 1, 1, 1};
136 }
137 } else if (fAttrAutopad == "SAME_UPPER" || fAttrAutopad == "SAME_LOWER") {
138 if (fDim == 1)
140 else if (fDim == 2)
142 else if (fDim == 3)
144 fAttrKernelShape[0] / 2, fAttrKernelShape[1] / 2, fAttrKernelShape[2] / 2};
145 // add extra padding at beginning or end (depending if SAME_UPPER or SAME_LOWER)
146 // need to check this!
147 if (fAttrKernelShape[0] % 2 == 1) {
148 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[0]++ : fAttrPads[i1]++;
149 }
150 if (fDim > 1 && fAttrKernelShape[1] % 2 == 1) {
151 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[1]++ : fAttrPads[i2]++;
152 }
153 if (fDim > 2 && fAttrKernelShape[2] % 2 == 1) {
154 (fAttrAutopad == "SAME_UPPER") ? fAttrPads[2]++ : fAttrPads[i3]++;
155 }
156 } else if (fAttrAutopad != "VALID") {
157 throw
158 std::runtime_error("TMVA SOFIE" + Name() + "Op invalid Autopad value : " + fAttrAutopad);
159 }
160 // to be sure pad is vector of size 6
161 if (fDim < 3) fAttrPads.resize(6, 0);
162
163 if (fAttrStrides.empty()) {
164 fAttrStrides = {1, 1, 1};
165 }
166
167 if (fDim < 3)
168 fAttrStrides.resize(3, 1);
169
170 size_t input1 = input[0][2];
171 size_t input2 = (fDim > 1) ? input[0][3] : 1;
172 size_t input3 = (fDim > 2) ? input[0][4] : 1;
173
174 size_t pad1 = fAttrPads[0] + fAttrPads[i1];
175 size_t output1 = (input1 + pad1 - fAttrKernelShape[0]) / fAttrStrides[0] + 1;
176
177 size_t batch_size = input[0][0]; // first element in input tensor
178 size_t output_channels = input[0][1]; // first element in output tensor
179
180 std::vector<std::vector<size_t>> ret({{ batch_size, output_channels, output1 }});
181
182 if (fDim == 1)
183 return ret;
184
185 size_t pad2 = fAttrPads[1] + fAttrPads[i2];
186 size_t output2 = (input2 + pad2 - fAttrKernelShape[1]) / fAttrStrides[1] + 1;
187 // output is N x C x OH x OW
188 ret[0].push_back(output2);
189 if (fDim == 2)
190 return ret;
191
192 size_t pad3 = fAttrPads[2] + fAttrPads[i3];
193 size_t output3 = (input3 + pad3 - fAttrKernelShape[2] ) / fAttrStrides[2] + 1;
194
195 // output is N x C x OH x OW x OD
196 ret[0].push_back(output3);
197 return ret;
198 }
199
200 void Initialize(RModel& model) {
201
202 fUseSession = model.UseSession();
203
204 if (!model.CheckIfTensorAlreadyExist(fNX)) {
205 throw
206 std::runtime_error("TMVA SOFIE Pool op Input Tensor " + fNX + " is not found in model");
207 }
208 fShapeX = model.GetTensorShape(fNX);
209 if (fShapeX.size() < 3 || fShapeX.size() > 5) {
210 std::cout << fNX << " : " << ConvertShapeToString(fShapeX) << std::endl;
211 throw
212 std::runtime_error("TMVA SOFIE Pool Op input data tensor" + fNX + " is not of 3,4 or 5 dimensions");
213 }
214 fDim = fShapeX.size() - 2;
215 // case of GlobalAveragePool. It is a pool case with kernel shape == image shape
218 fAttrKernelShape.resize(3);
220 if (fDim > 1)
222 if (fDim > 2)
224 fAttrAutopad = "VALID";
225 fAttrPads = {0, 0, 0, 0, 0, 0 };
226 assert(fAttrStrides.empty());
227 }
228 // find shape of Y and add it in the list of intermediate tensors
231
232 // need cmath for INFINITY when using MaxPool
233 if (fPoolMode == MaxPool) model.AddNeededStdLib("cmath");
234
235 }
236
237 std::string GenerateInitCode() {
238 std::stringstream out;
239 return out.str();
240 }
241
242 // generate code for Session data members (e.g. internal vectors)
243 virtual std::string GenerateSessionMembersCode(std::string opName)
244 {
245 opName = "op_" + opName;
246 std::stringstream out;
247 // input matrix padded with zero
248 if(fDim == 1){
249 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
250 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) << ");\n";
251 }
252 else if(fDim == 2){
253 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
254 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3])
255 << ");\n";
256 }
257 else{ //dim is 3D
258 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
259 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3]) *
260 (fShapeX[4] + fAttrPads[2] + fAttrPads[4]) << ");\n";
261 }
262
263 return out.str();
264 }
265
266 std::string Generate(std::string OpName) {
267 OpName = "op_" + OpName;
268
269 if (fShapeX.empty() || fShapeY.empty()) {
270 throw std::runtime_error("TMVA SOFIE Pool Op called to Generate without being initialized first");
271 }
272
273 std::stringstream out;
274
275 out << "\n//---- operator " << Name() << " " << OpName << "\n";
276 out << "{\n"; // create a new scope to avoid name clash
277
278 assert(fShapeX[0] == fShapeY[0]);
279 assert(fShapeX[1] == fShapeY[1]);
280 assert(fAttrPads.size() == 6);
281 assert(fAttrKernelShape.size() == 3);
282 // find lower bounds of filtered area
283 int hmin = - fAttrPads[0]; // minimum lower bound value of filter area
284 int hmax = fShapeX[2] + fAttrPads[1] - fAttrKernelShape[0] +1; // maximum lower bound value + 1
285 int wmin,wmax,dmin,dmax;
286
287 if(fDim >= 2){
288 wmin = - fAttrPads[2]; // minimum lower bound value of filter area
289 wmax = fShapeX[3] + fAttrPads[3] - fAttrKernelShape[1] +1; // maximum lower bound value + 1
290 }
291 else{
292 wmin=1;
293 wmax=1;
294 }
295 if(fDim == 3){
296 dmin = - fAttrPads[4]; // minimum lower bound value of filter area
297 dmax = fShapeX[4] + fAttrPads[5] - fAttrKernelShape[2] +1; // maximum lower bound value + 1
298 }
299 else{
300 dmin=1;
301 dmax=1;
302 }
303 out << SP << "constexpr int hsize = " << fShapeX[2] << ";\n";
304 out << SP << "constexpr int hmin = " << hmin << ";\n";
305 out << SP << "constexpr int hmax = " << hmax << ";\n";
306 out << SP << "constexpr int kh = " << fAttrKernelShape[0] << ";\n";
307 if (fDim > 1) {
308 size_t wsize = fShapeX[3];
309 out << SP << "constexpr int wsize = " << wsize << ";\n";
310 out << SP << "constexpr int wmin = " << wmin << ";\n";
311 out << SP << "constexpr int wmax = " << wmax << ";\n";
312 out << SP << "constexpr int kw = " << fAttrKernelShape[1] << ";\n";
313 if (fDim > 2) {
314 size_t dsize = fShapeX[4];
315 out << SP << "constexpr int dsize = " << dsize << ";\n";
316 out << SP << "constexpr int dwsize = " << dsize*wsize << ";\n"; // hstride
317 out << SP << "constexpr int dmin = " << dmin << ";\n";
318 out << SP << "constexpr int dmax = " << dmax << ";\n";
319 out << SP << "constexpr int kd = " << fAttrKernelShape[2] << ";\n";
320 }
321 }
322
323
324 bool doPadding = false;
325 for ( auto & e : fAttrPads)
326 doPadding |= (e > 0);
327
328
329 if(fDim==1){
330 // loop on batches and channels
331 out << SP << "size_t outIndex = 0;\n";
332 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
333 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2] << ";\n";
334 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
335 // loop on elements of filter region to compute maximum
336 if (fPoolMode == MaxPool)
337 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
338 else if (fPoolMode == AveragePool) {
339 out << SP << SP << SP << SP << "float value = 0;\n";
340 if (fAttrCountIncludePad == 0 && doPadding)
341 out << SP << SP << SP << SP << "int nsum = 0;\n";
342 else // in case we count the pad values in average
343 out << SP << SP << SP << SP << "constexpr int nsum = kh;\n";
344 }
345 // loop on rows of filtered region
346 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
347 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
348 out << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l;\n";
349 if (fPoolMode == MaxPool) {
350 out << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
351 out << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
352 }
353 else if (fPoolMode == AveragePool) {
354 // compute sum of values
355 out << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
356 if (fAttrCountIncludePad == 0 && doPadding)
357 // compute number of elements used for the average
358 out << SP << SP << SP << SP << SP << SP << "nsum++;\n";
359 }
360 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
361 if (fPoolMode == AveragePool) {
362 // compute average
363 out << SP << SP << SP << SP << "value /= float(nsum);\n";
364 }
365
366 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
367
368 out << SP << SP << "}\n"; // end loop on i (image rows)
369 out << SP << "}\n"; // end loop on c*b
370 }
371 else if(fDim==2){
372 // loop on batches and channels
373 out << SP << "size_t outIndex = 0;\n";
374 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
375 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3] << ";\n";
376 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
377 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
378 // loop on elements of filter region to compute maximum
379 if (fPoolMode == MaxPool)
380 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
381 else if (fPoolMode == AveragePool) {
382 out << SP << SP << SP << SP << "float value = 0;\n";
383 if (fAttrCountIncludePad == 0 && doPadding)
384 out << SP << SP << SP << SP << "int nsum = 0;\n";
385 else // in case we count the pad values in average
386 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh;\n";
387 }
388 // loop on rows of filtered region
389 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
390 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
391 // loop on columns of filtered region
392 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
393 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
394 out << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*wsize + m;\n";
395 if (fPoolMode == MaxPool) {
396 out << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
397 out << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
398 }
399 else if (fPoolMode == AveragePool) {
400 // compute sum of values
401 out << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
402 if (fAttrCountIncludePad == 0 && doPadding)
403 // compute number of elements used for the average
404 out << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
405 }
406 out << SP << SP << SP << SP << SP << SP << "}\n";
407 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
408 if (fPoolMode == AveragePool) {
409 // compute average
410 out << SP << SP << SP << SP << "value /= float(nsum);\n";
411 }
412 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
413 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
414 out << SP << SP << "}\n"; // end loop on i (image rows)
415 out << SP << "}\n"; // end loop on c*b
416 }
417 else if(fDim==3){
418 // loop on batches and channels
419 out << SP << "size_t outIndex = 0;\n";
420 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
421 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3]*fShapeX[4] << ";\n";
422 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
423 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
424 out << SP << SP << SP << SP << "for (int k = dmin; k < dmax; k+=" << fAttrStrides[2] << ") {\n";
425 // loop on elements of filter region to compute maximum
426 if (fPoolMode == MaxPool)
427 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
428 else if (fPoolMode == AveragePool) {
429 out << SP << SP << SP << SP << "float value = 0;\n";
430 if (fAttrCountIncludePad == 0 && doPadding)
431 out << SP << SP << SP << SP << "int nsum = 0;\n";
432 else // in case we count the pad values in average
433 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh*kd;\n";
434 }
435 // loop on rows of filtered region
436 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
437 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
438 // loop on columns of filtered region
439 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
440 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
441 // loop on layers of filtered region
442 out << SP << SP << SP << SP << SP << SP << "for (int p = k; p < k + kd; p++) {\n";
443 out << SP << SP << SP << SP << SP << SP << SP << "if (p < 0 || p >= dsize) continue;\n";
444 out << SP << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*dwsize + m*dsize + p;\n";
445
446 if (fPoolMode == MaxPool) {
447 out << SP << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
448 out << SP << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
449 }
450 else if (fPoolMode == AveragePool) {
451 // compute sum of values
452 out << SP << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
453 if (fAttrCountIncludePad == 0 && doPadding)
454 // compute number of elements used for the average
455 out << SP << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
456 }
457 out << SP << SP << SP << SP << SP << SP << "}\n";
458 out << SP << SP << SP << SP << SP << "}\n";
459 out << SP << SP << SP << SP << "}\n"; // end loop on region elements
460 if (fPoolMode == AveragePool) {
461 // compute average
462 out << SP << SP << SP << SP << "value /= float(nsum);\n";
463 }
464
465 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
466 out << SP << SP << SP << SP << "}\n" ; // end loop on k (layers of image)
467 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
468 out << SP << SP << "}\n"; // end loop on i (image rows)
469 out << SP << "}\n"; // end loop on c*b
470 }
471 // end scope
472 out << SP << "}\n";
473
474
475 return out.str();
476 }
477};
478
479} // namespace SOFIE
480} // namespace Experimental
481} // namespace TMVA
482
483
484#endif
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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
const ETensorType & GetTensorType(std::string name)
Definition RModel.cxx:80
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< std::size_t > shape)
Definition RModel.cxx:160
bool CheckIfTensorAlreadyExist(std::string tensor_name)
Definition RModel.cxx:101
void AddNeededStdLib(std::string libname)
Definition RModel.hxx:88
const std::vector< size_t > & GetTensorShape(std::string name)
Definition RModel.cxx:59
std::string Generate(std::string OpName)
std::vector< ETensorType > TypeInference(std::vector< ETensorType > input)
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > > input)
virtual std::string GenerateSessionMembersCode(std::string opName)
ROperator_Pool(PoolOpMode mode, RAttributes_Pool attr, std::string nameX, std::string nameY)
const std::string SP
space used to correctly indent the generated C++ code
Definition ROperator.hxx:41
std::string ConvertShapeToString(std::vector< size_t > shape)
create variable transformations