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) {
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) {
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() {
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)
247 {
248 opName = "op_" + opName;
249 std::stringstream out;
250 // input matrix padded with zero
251 if(fDim == 1){
252 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
253 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) << ");\n";
254 }
255 else if(fDim == 2){
256 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
257 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3])
258 << ");\n";
259 }
260 else{ //dim is 3D
261 out << "std::vector<" << fType << "> fVec_" << opName << "_xpad = std::vector<" << fType << ">("
262 << fShapeX[1] * (fShapeX[2] + fAttrPads[0] + fAttrPads[2]) * (fShapeX[3] + fAttrPads[1] + fAttrPads[3]) *
263 (fShapeX[4] + fAttrPads[2] + fAttrPads[4]) << ");\n";
264 }
265
266 return out.str();
267 }
268
269 std::string Generate(std::string OpName) {
270 OpName = "op_" + OpName;
271
272 if (fShapeX.empty() || fShapeY.empty()) {
273 throw std::runtime_error("TMVA SOFIE Pool Op called to Generate without being initialized first");
274 }
275
276 std::stringstream out;
277
278 out << "\n//---- operator " << Name() << " " << OpName << "\n";
279 out << "{\n"; // create a new scope to avoid name clash
280
281 assert(fShapeX[0] == fShapeY[0]);
282 assert(fShapeX[1] == fShapeY[1]);
283 assert(fAttrPads.size() == 6);
284 assert(fAttrKernelShape.size() == 3);
285 // find lower bounds of filtered area
286 int hmin = - fAttrPads[0]; // minimum lower bound value of filter area
287 int hmax = fShapeX[2] + fAttrPads[1] - fAttrKernelShape[0] +1; // maximum lower bound value + 1
288 int wmin,wmax,dmin,dmax;
289
290 if(fDim >= 2){
291 wmin = - fAttrPads[2]; // minimum lower bound value of filter area
292 wmax = fShapeX[3] + fAttrPads[3] - fAttrKernelShape[1] +1; // maximum lower bound value + 1
293 }
294 else{
295 wmin=1;
296 wmax=1;
297 }
298 if(fDim == 3){
299 dmin = - fAttrPads[4]; // minimum lower bound value of filter area
300 dmax = fShapeX[4] + fAttrPads[5] - fAttrKernelShape[2] +1; // maximum lower bound value + 1
301 }
302 else{
303 dmin=1;
304 dmax=1;
305 }
306 out << SP << "constexpr int hsize = " << fShapeX[2] << ";\n";
307 out << SP << "constexpr int hmin = " << hmin << ";\n";
308 out << SP << "constexpr int hmax = " << hmax << ";\n";
309 out << SP << "constexpr int kh = " << fAttrKernelShape[0] << ";\n";
310 if (fDim > 1) {
311 size_t wsize = fShapeX[3];
312 out << SP << "constexpr int wsize = " << wsize << ";\n";
313 out << SP << "constexpr int wmin = " << wmin << ";\n";
314 out << SP << "constexpr int wmax = " << wmax << ";\n";
315 out << SP << "constexpr int kw = " << fAttrKernelShape[1] << ";\n";
316 if (fDim > 2) {
317 size_t dsize = fShapeX[4];
318 out << SP << "constexpr int dsize = " << dsize << ";\n";
319 out << SP << "constexpr int dwsize = " << dsize*wsize << ";\n"; // hstride
320 out << SP << "constexpr int dmin = " << dmin << ";\n";
321 out << SP << "constexpr int dmax = " << dmax << ";\n";
322 out << SP << "constexpr int kd = " << fAttrKernelShape[2] << ";\n";
323 }
324 }
325
326
327 bool doPadding = false;
328 for ( auto & e : fAttrPads)
329 doPadding |= (e > 0);
330
331
332 if(fDim==1){
333 // loop on batches and channels
334 out << SP << "size_t outIndex = 0;\n";
335 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
336 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2] << ";\n";
337 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
338 // loop on elements of filter region to compute maximum
339 if (fPoolMode == MaxPool)
340 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
341 else if (fPoolMode == AveragePool) {
342 out << SP << SP << SP << SP << "float value = 0;\n";
344 out << SP << SP << SP << SP << "int nsum = 0;\n";
345 else // in case we count the pad values in average
346 out << SP << SP << SP << SP << "constexpr int nsum = kh;\n";
347 }
348 // loop on rows of filtered region
349 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
350 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
351 out << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l;\n";
352 if (fPoolMode == MaxPool) {
353 out << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
354 out << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
355 }
356 else if (fPoolMode == AveragePool) {
357 // compute sum of values
358 out << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
360 // compute number of elements used for the average
361 out << SP << SP << SP << SP << SP << SP << "nsum++;\n";
362 }
363 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
364 if (fPoolMode == AveragePool) {
365 // compute average
366 out << SP << SP << SP << SP << "value /= float(nsum);\n";
367 }
368
369 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
370
371 out << SP << SP << "}\n"; // end loop on i (image rows)
372 out << SP << "}\n"; // end loop on c*b
373 }
374 else if(fDim==2){
375 // loop on batches and channels
376 out << SP << "size_t outIndex = 0;\n";
377 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
378 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3] << ";\n";
379 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
380 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
381 // loop on elements of filter region to compute maximum
382 if (fPoolMode == MaxPool)
383 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
384 else if (fPoolMode == AveragePool) {
385 out << SP << SP << SP << SP << "float value = 0;\n";
387 out << SP << SP << SP << SP << "int nsum = 0;\n";
388 else // in case we count the pad values in average
389 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh;\n";
390 }
391 // loop on rows of filtered region
392 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
393 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
394 // loop on columns of filtered region
395 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
396 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
397 out << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*wsize + m;\n";
398 if (fPoolMode == MaxPool) {
399 out << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
400 out << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
401 }
402 else if (fPoolMode == AveragePool) {
403 // compute sum of values
404 out << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
406 // compute number of elements used for the average
407 out << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
408 }
409 out << SP << SP << SP << SP << SP << SP << "}\n";
410 out << SP << SP << SP << SP << SP << "}\n"; // end loop on region elements
411 if (fPoolMode == AveragePool) {
412 // compute average
413 out << SP << SP << SP << SP << "value /= float(nsum);\n";
414 }
415 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
416 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
417 out << SP << SP << "}\n"; // end loop on i (image rows)
418 out << SP << "}\n"; // end loop on c*b
419 }
420 else if(fDim==3){
421 // loop on batches and channels
422 out << SP << "size_t outIndex = 0;\n";
423 out << SP << "for (size_t n = 0; n < " << fShapeX[0]*fShapeX[1] << "; n++) {\n";
424 out << SP << SP << "size_t inputOffset = n*" << fShapeX[2]*fShapeX[3]*fShapeX[4] << ";\n";
425 out << SP << SP << "for (int i = hmin; i < hmax; i+=" << fAttrStrides[0] << ") {\n";
426 out << SP << SP << SP << "for (int j = wmin; j < wmax; j+=" << fAttrStrides[1] << ") {\n";
427 out << SP << SP << SP << SP << "for (int k = dmin; k < dmax; k+=" << fAttrStrides[2] << ") {\n";
428 // loop on elements of filter region to compute maximum
429 if (fPoolMode == MaxPool)
430 out << SP << SP << SP << SP << "float value = -INFINITY;\n";
431 else if (fPoolMode == AveragePool) {
432 out << SP << SP << SP << SP << "float value = 0;\n";
434 out << SP << SP << SP << SP << "int nsum = 0;\n";
435 else // in case we count the pad values in average
436 out << SP << SP << SP << SP << "constexpr int nsum = kw*kh*kd;\n";
437 }
438 // loop on rows of filtered region
439 out << SP << SP << SP << SP << "for (int l = i; l < i + kh; l++) {\n";
440 out << SP << SP << SP << SP << SP << "if (l < 0 || l >= hsize) continue;\n";
441 // loop on columns of filtered region
442 out << SP << SP << SP << SP << SP << "for (int m = j; m < j + kw; m++) {\n";
443 out << SP << SP << SP << SP << SP << SP << "if (m < 0 || m >= wsize) continue;\n";
444 // loop on layers of filtered region
445 out << SP << SP << SP << SP << SP << SP << "for (int p = k; p < k + kd; p++) {\n";
446 out << SP << SP << SP << SP << SP << SP << SP << "if (p < 0 || p >= dsize) continue;\n";
447 out << SP << SP << SP << SP << SP << SP << SP << SP << "int index = inputOffset + l*dwsize + m*dsize + p;\n";
448
449 if (fPoolMode == MaxPool) {
450 out << SP << SP << SP << SP << SP << SP << SP << SP << "auto xval = tensor_" << fNX << "[index];\n";
451 out << SP << SP << SP << SP << SP << SP << SP << SP << "if (xval > value) value = xval;\n";
452 }
453 else if (fPoolMode == AveragePool) {
454 // compute sum of values
455 out << SP << SP << SP << SP << SP << SP << SP << SP << "value += tensor_" << fNX << "[index];\n";
457 // compute number of elements used for the average
458 out << SP << SP << SP << SP << SP << SP << SP << SP << "nsum++;\n";
459 }
460 out << SP << SP << SP << SP << SP << SP << "}\n";
461 out << SP << SP << SP << SP << SP << "}\n";
462 out << SP << SP << SP << SP << "}\n"; // end loop on region elements
463 if (fPoolMode == AveragePool) {
464 // compute average
465 out << SP << SP << SP << SP << "value /= float(nsum);\n";
466 }
467
468 out << SP << SP << SP << SP << "tensor_" << fNY << "[outIndex++] = value;\n";
469 out << SP << SP << SP << SP << "}\n" ; // end loop on k (layers of image)
470 out << SP << SP << SP << "}\n"; // end loop on j (columns of image)
471 out << SP << SP << "}\n"; // end loop on i (image rows)
472 out << SP << "}\n"; // end loop on c*b
473 }
474 // end scope
475 out << SP << "}\n";
476
477
478 return out.str();
479 }
480};
481
482} // namespace SOFIE
483} // namespace Experimental
484} // namespace TMVA
485
486
487#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
std::string Generate(std::string OpName)
void Initialize(RModel &model) override
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)
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