1#ifndef TMVA_SOFIE_ROPERATOR_SLICE 
    2#define TMVA_SOFIE_ROPERATOR_SLICE 
   13namespace Experimental{
 
   18template <
typename IType>
 
   48    for (
size_t i = 0; i < names.size(); ++i) {
 
   52    if (names.size() == 3) {
 
   53      if (names[2] != 
"axes") { 
 
 
   74      auto ret = std::vector<ETensorType>(1, 
input[0]);
 
 
   93         throw std::runtime_error(
"TMVA Slice Op Input Tensor is not found in model");
 
   96      std::vector<std::vector<size_t>> 
shapes;
 
  100      std::vector<std::vector<IType>> 
itensors(4);
 
  103      for (
size_t i = 0; i < 
fNames.size(); ++i) {
 
  134      fSteps = std::vector<size_t>(dim, 1);
 
  135      fStart = std::vector<size_t>(dim, 0);
 
  145      if (
iaxes.size() > 0) {
 
  146        for (
size_t i = 0; i < 
iaxes.size(); i++) {
 
  154            if (start < 0) start = 0;
 
  167                  throw std::runtime_error(
"TMVA Slice Op : negative steps not supported");
 
 
  182         throw std::runtime_error(
"TMVA SOFIE Slice Op called to Generate without being initialized first");
 
  185      std::stringstream out;
 
  188      out << 
SP << 
"///------- Slice operator\n" << std::endl;
 
  191      std::vector<size_t> strides(ndim,1);
 
  192      for (
int i = 
int(ndim-2); i >=0 ; i--) {
 
  197      out << 
SP << 
"size_t iOut = 0;\n";
 
  198      std::string 
MSP = 
SP;
 
  203        if (
idim < ndim-1) out << 
MSP << 
"size_t stride" << 
idim << 
" = " << strides[
idim] << 
"*i" << 
idim << 
";\n";
 
  205      out << 
MSP << 
"size_t iInput = ";
 
  206      for (
size_t idim = 0; 
idim < ndim-1; 
idim++) out << 
" stride" << 
idim << 
" + ";
 
  208      out << 
"i" << ndim-1 << 
";\n";
 
  209      out << 
MSP << 
"tensor_" << 
fNOutput << 
"[iOut++] = tensor_" <<
fNData << 
"[iInput];\n";
 
  211          MSP = 
MSP.replace(0,
SP.length(),
"");
 
 
 
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
const ETensorType & GetTensorType(std::string name)
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
bool CheckIfTensorAlreadyExist(std::string tensor_name)
const std::vector< size_t > & GetTensorShape(std::string name)
std::shared_ptr< void > GetInitializedTensorData(std::string tensor_name)
std::vector< std::vector< IType > > fAttributes
std::vector< size_t > fEnd
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > > input)
std::vector< ETensorType > TypeInference(std::vector< ETensorType > input)
std::vector< size_t > fStart
std::vector< size_t > fSteps
std::vector< size_t > fShapeInput
ROperator_Slice(std::string nameData, std::vector< IType > starts, std::vector< IType > ends, std::vector< IType > axes, std::string nameOutput)
void Initialize(RModel &model)
ROperator_Slice(std::string nameData, std::vector< std::string > names, std::string nameOutput)
std::string Generate(std::string OpName)
std::vector< std::string > fNames
std::vector< size_t > fShapeOutput
const std::string SP
space used to correctly indent the generated C++ code
std::string Clean_name(std::string input_tensor_name)
create variable transformations