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>
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 (fAttrStrides.empty()) {
136 fAttrStrides = {1, 1, 1};
137 }
138 if (fDim < 3)
139 fAttrStrides.resize(3, 1);
140
141 if (fAttrAutopad == "NOTSET") {
142 // in auto_pad is NOTSET then fAttrPads should have been set or default zero is used
143 if (fAttrPads.empty()) {
144 fAttrPads = {0, 0, 0, 0, 0, 0};
145 }
146 } else if (fAttrAutopad == "SAME_UPPER" || fAttrAutopad == "SAME_LOWER") {
147 // ONNX SAME padding: total_pad = max(0, (ceil(in/stride)-1)*stride + kernel - in)
148 // SAME_UPPER places extra padding at end, SAME_LOWER at beginning
149 fAttrPads.assign(6, 0);
150 for (size_t d = 0; d < fDim; ++d) {
151 size_t inSize = input[0][d + 2];
152 size_t stride_d = fAttrStrides[d];
153 size_t outSize = (inSize + stride_d - 1) / stride_d;
154 int totalPad = std::max(0, (int)((outSize - 1) * stride_d + fAttrKernelShape[d]) - (int)inSize);
155 if (fAttrAutopad == "SAME_UPPER") {
156 fAttrPads[d] = (size_t)(totalPad / 2);
157 fAttrPads[d + fDim] = (size_t)(totalPad - totalPad / 2);
158 } else {
159 fAttrPads[d] = (size_t)(totalPad - totalPad / 2);
160 fAttrPads[d + fDim] = (size_t)(totalPad / 2);
161 }
162 }
163 } else if (fAttrAutopad != "VALID") {
164 throw
165 std::runtime_error("TMVA SOFIE" + Name() + "Op invalid Autopad value : " + fAttrAutopad);
166 }
167 // to be sure pad is vector of size 6
168 if (fDim < 3) fAttrPads.resize(6, 0);
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 // use ceiling division when ceil_mode=1, floor otherwise. With ceil_mode the rounding up can add
175 // a window that starts past the end of the input (i.e. entirely in the right padding or in the
176 // overhang region); ONNX ignores such a window, so clip to the number of valid window starts.
177 auto poolOutDim = [this](size_t in, size_t padBegin, size_t padEnd, size_t kern, size_t stride) -> size_t {
178 size_t n = in + padBegin + padEnd - kern;
179 if (!fAttrCeilMode)
180 return n / stride + 1;
181 return std::min((n + stride - 1) / stride, (in - 1 + padBegin) / stride) + 1;
182 };
183
185
186 size_t batch_size = input[0][0]; // first element in input tensor
187 size_t output_channels = input[0][1]; // first element in output tensor
188
189 std::vector<std::vector<size_t>> ret({{ batch_size, output_channels, output1 }});
190
191 if (fDim == 1)
192 return ret;
193
195 // output is N x C x OH x OW
196 ret[0].push_back(output2);
197 if (fDim == 2)
198 return ret;
199
201
202 // output is N x C x OH x OW x OD
203 ret[0].push_back(output3);
204 return ret;
205 }
206
207 void Initialize(RModel& model) override {
208
209 fUseSession = model.UseSession();
210
211 if (!model.CheckIfTensorAlreadyExist(fNX)) {
212 throw
213 std::runtime_error("TMVA SOFIE Pool op Input Tensor " + fNX + " is not found in model");
214 }
215 fShapeX = model.GetTensorShape(fNX);
216 if (fShapeX.size() < 3 || fShapeX.size() > 5) {
217 std::cout << fNX << " : " << ConvertShapeToString(fShapeX) << std::endl;
218 throw
219 std::runtime_error("TMVA SOFIE Pool Op input data tensor" + fNX + " is not of 3,4 or 5 dimensions");
220 }
221 fDim = fShapeX.size() - 2;
222 // case of GlobalAveragePool. It is a pool case with kernel shape == image shape
225 fAttrKernelShape.resize(3);
227 if (fDim > 1)
229 if (fDim > 2)
231 fAttrAutopad = "VALID";
232 fAttrPads = {0, 0, 0, 0, 0, 0 };
233 assert(fAttrStrides.empty());
234 }
235 // find shape of Y and add it in the list of intermediate tensors
238
239 // need cmath for INFINITY when using MaxPool
240 if (fPoolMode == MaxPool) model.AddNeededStdLib("cmath");
241
242 }
243
244 std::string GenerateInitCode() override {
245 std::stringstream out;
246 return out.str();
247 }
248
249
250 std::string Generate(std::string OpName) override {
251 OpName = "op_" + OpName;
252
253 if (fShapeX.empty() || fShapeY.empty()) {
254 throw std::runtime_error("TMVA SOFIE Pool Op called to Generate without being initialized first");
255 }
256
257 std::stringstream out;
258
259 out << "\n//---- operator " << Name() << " " << OpName << "\n";
260 out << "{\n"; // create a new scope to avoid name clash
261
262 assert(fShapeX[0] == fShapeY[0]);
263 assert(fShapeX[1] == fShapeY[1]);
264 assert(fAttrPads.size() == 6);
265 assert(fAttrKernelShape.size() == 3);
266 // A window must start inside the input: with ceil_mode the loop bound below can otherwise run one
267 // window too far, which ONNX ignores. This mirrors the clipping done in ShapeInference.
268 auto clipToInput = [this](int upper, size_t size) {
269 return (fAttrCeilMode && upper > (int)size) ? (int)size : upper;
270 };
271 // find lower bounds of filtered area
272 int hmin = - fAttrPads[0]; // minimum lower bound value of filter area
273 // use stride instead of 1 when ceil_mode=1, so the loop covers the extra partial window
275 fShapeX[2]);
276 int wmin,wmax,dmin,dmax;
277
278 if(fDim >= 2){
279 wmin = -fAttrPads[1]; // minimum lower bound value of filter area
281 fShapeX[3]);
282 }
283 else{
284 wmin=1;
285 wmax=1;
286 }
287 if(fDim == 3){
288 dmin = -fAttrPads[2]; // minimum lower bound value of filter area
290 fShapeX[4]);
291 }
292 else{
293 dmin=1;
294 dmax=1;
295 }
296 out << SP << "constexpr int hsize = " << fShapeX[2] << ";\n";
297 out << SP << "constexpr int hmin = " << hmin << ";\n";
298 out << SP << "constexpr int hmax = " << hmax << ";\n";
299 out << SP << "constexpr int kh = " << fAttrKernelShape[0] << ";\n";
300 if (fDim > 1) {
301 size_t wsize = fShapeX[3];
302 out << SP << "constexpr int wsize = " << wsize << ";\n";
303 out << SP << "constexpr int wmin = " << wmin << ";\n";
304 out << SP << "constexpr int wmax = " << wmax << ";\n";
305 out << SP << "constexpr int kw = " << fAttrKernelShape[1] << ";\n";
306 if (fDim > 2) {
307 size_t dsize = fShapeX[4];
308 out << SP << "constexpr int dsize = " << dsize << ";\n";
309 out << SP << "constexpr int dwsize = " << dsize*wsize << ";\n"; // hstride
310 out << SP << "constexpr int dmin = " << dmin << ";\n";
311 out << SP << "constexpr int dmax = " << dmax << ";\n";
312 out << SP << "constexpr int kd = " << fAttrKernelShape[2] << ";\n";
313 }
314 }
315
316
317 bool doPadding = false;
318 for ( auto & e : fAttrPads)
319 doPadding |= (e > 0);
320
321 // An AveragePool window can cover fewer cells than the kernel area either because it overlaps the
322 // padding region or because ceil_mode lets the last window overhang the input. In both cases the
323 // divisor has to be computed per window instead of being the constant kernel area.
325 // Number of cells the window starting at "var" covers along one dimension: the kernel extent
326 // clipped to [0, size) when count_include_pad = 0, and to the padded input [-padBegin, size +
327 // padEnd) otherwise. The lower bound needs no clipping in the latter case, since "var" starts at
328 // -padBegin. Note that the cells the window overhangs past the padded input are never counted.
329 auto windowExtent = [this](const std::string &var, const std::string &kern, size_t size, size_t padEnd) {
330 std::string hi = std::to_string(fAttrCountIncludePad ? size + padEnd : size);
331 std::string lo = fAttrCountIncludePad ? var : "(" + var + " > 0 ? " + var + " : 0)";
332 return "((" + var + " + " + kern + " < " + hi + " ? " + var + " + " + kern + " : " + hi + ")"
333 " - " + lo + ")";
334 };
335
336
337 if(fDim==1){
338 // loop on batches and channels
339 out << SP << "size_t outIndex = 0;\n";
340 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
341 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2] << ";\n";
342 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
343 // loop on elements of filter region to compute maximum
344 if (fPoolMode == MaxPool)
345 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
346 else if (fPoolMode == AveragePool) {
347 out << SP << SP << SP << SP << "float value = 0;\n";
348 if (dynamicDivisor)
349 out << SP << SP << SP << SP << "const int nsum = "
350 << windowExtent("i", "kh", fShapeX[2], fAttrPads[fDim]) << ";\n";
351 else // every window is full, so the divisor is the kernel area
352 out << SP << SP << SP << SP << "constexpr int nsum = kh;\n";
353 }
354 // loop on rows of filtered region
355 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
356 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
357 out << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l;\n";
358 if (fPoolMode == MaxPool) {
359 out << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
360 out << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
361 }
362 else if (fPoolMode == AveragePool) {
363 // compute sum of values
364 out << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
365 }
366 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
367 if (fPoolMode == AveragePool) {
368 // compute average
369 out << SP << SP << SP << SP << "value /= float(nsum);\n";
370 }
371
372 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
373
374 out << SP << SP << "}\n"; // end loop on i (image rows)
375 out << SP << "}\n"; // end loop on c*b
376 }
377 else if(fDim==2){
378 // loop on batches and channels
379 out << SP << "size_t outIndex = 0;\n";
380 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
381 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3] << ";\n";
382 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
383 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
384 // loop on elements of filter region to compute maximum
385 if (fPoolMode == MaxPool)
386 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
387 else if (fPoolMode == AveragePool) {
388 out << SP << SP << SP << SP << "float value = 0;\n";
389 if (dynamicDivisor)
390 out << SP << SP << SP << SP << "const int nsum = "
391 << windowExtent("i", "kh", fShapeX[2], fAttrPads[fDim]) << " * "
392 << windowExtent("j", "kw", fShapeX[3], fAttrPads[fDim + 1]) << ";\n";
393 else // every window is full, so the divisor is the kernel area
394 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh;\n";
395 }
396 // loop on rows of filtered region
397 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
398 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
399 // loop on columns of filtered region
400 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
401 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
402 out << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*wsize + m;\n";
403 if (fPoolMode == MaxPool) {
404 out << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
405 out << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
406 }
407 else if (fPoolMode == AveragePool) {
408 // compute sum of values
409 out << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
410 }
411 out << SP << SP << SP << SP << SP << SP << "}\n";
412 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
413 if (fPoolMode == AveragePool) {
414 // compute average
415 out << SP << SP << SP << SP << "value /= float(nsum);\n";
416 }
417 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
418 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
419 out << SP << SP << "}\n"; // end loop on i (image rows)
420 out << SP << "}\n"; // end loop on c*b
421 }
422 else if(fDim==3){
423 // loop on batches and channels
424 out << SP << "size_t outIndex = 0;\n";
425 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
426 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3]*fShapeX[4] << ";\n";
427 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
428 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
429 out << SP << SP << SP << SP << "for (int k = dmin; k < dmax; k+=" << fAttrStrides[2] << ") {\n";
430 // loop on elements of filter region to compute maximum
431 if (fPoolMode == MaxPool)
432 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
433 else if (fPoolMode == AveragePool) {
434 out << SP << SP << SP << SP << "float value = 0;\n";
435 if (dynamicDivisor)
436 out << SP << SP << SP << SP << "const int nsum = "
437 << windowExtent("i", "kh", fShapeX[2], fAttrPads[fDim]) << " * "
438 << windowExtent("j", "kw", fShapeX[3], fAttrPads[fDim + 1]) << " * "
439 << windowExtent("k", "kd", fShapeX[4], fAttrPads[fDim + 2]) << ";\n";
440 else // every window is full, so the divisor is the kernel area
441 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh*kd;\n";
442 }
443 // loop on rows of filtered region
444 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
445 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
446 // loop on columns of filtered region
447 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
448 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
449 // loop on layers of filtered region
450 out << SP << SP << SP << SP << SP << SP << "for (int p = k; p < k + kd; p++) {\n";
451 out << SP << SP << SP << SP << SP << SP << SP << "if (p < 0 || p >= dsize) continue;\n";
452 out << SP << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*dwsize + m*dsize + p;\n";
453
454 if (fPoolMode == MaxPool) {
455 out << SP << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
456 out << SP << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
457 }
458 else if (fPoolMode == AveragePool) {
459 // compute sum of values
460 out << SP << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
461 }
462 out << SP << SP << SP << SP << SP << SP << "}\n";
463 out << SP << SP << SP << SP << SP << "}\n";
464 out << SP << SP << SP << SP << "}\n"; // end loop on region elements
465 if (fPoolMode == AveragePool) {
466 // compute average
467 out << SP << SP << SP << SP << "value /= float(nsum);\n";
468 }
469
470 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
471 out << SP << SP << SP << SP << "}\n" ; // end loop on k (layers of image)
472 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
473 out << SP << SP << "}\n"; // end loop on i (image rows)
474 out << SP << "}\n"; // end loop on c*b
475 }
476 // end scope
477 out << SP << "}\n";
478
479
480 return out.str();
481 }
482};
483
484} // namespace SOFIE
485} // namespace Experimental
486} // namespace TMVA
487
488
489#endif
#define d(i)
Definition RSha256.hxx:102
#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
#define hi
void AddNeededStdLib(std::string libname)
std::vector< size_t > GetTensorShape(const std::string &name) const
Definition RModel.cxx:64
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
Definition RModel.cxx:311
bool CheckIfTensorAlreadyExist(std::string tensor_name)
Definition RModel.cxx:157
ETensorType GetTensorType(std::string name) const
Definition RModel.cxx:125
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:50
const std::string SP
space used to correctly indent the generated C++ code
Definition ROperator.hxx:45
std::vector< std::string_view > fOutputTensorNames
Definition ROperator.hxx:51
const Int_t n
Definition legend1.C:16
std::string ConvertShapeToString(const std::vector< size_t > &shape)
create variable transformations