1#ifndef TMVA_SOFIE_ROPERATOR_Concat 
    2 #define TMVA_SOFIE_ROPERATOR_Concat 
   16 namespace Experimental{
 
   39                   [](
const std::string& s) -> std::string_view { return s; });
 
 
   49             std::vector<std::vector<size_t>> 
ret(1);
 
   55               throw std::runtime_error(
"TMVA SOFIE Concat Op - invalid axis value ");
 
   59               for (
size_t i = 0; i < 
inputs.size(); i++) {
 
   61                     throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have different shapes " +
 
   67                        throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have wrong shapes " +
 
   77            std::vector<int> stack;
 
   79               for(
size_t i = 0; i < 
inputs.size(); i++) {
 
   81                  throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have different shapes " + 
fInputs[i] + 
" : " +
 
   88                        throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have wrong shapes " +
 
 
  102            std::vector<std::vector<Dim>> 
ret(1);
 
  108               throw std::runtime_error(
"TMVA SOFIE Concat Op - invalid axis value ");
 
  112               for (
size_t i = 0; i < 
inputs.size(); i++) {
 
  114                     throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have different shapes " + 
fInputs[i] + 
" : " +
 
  120                           throw std::runtime_error(
"TMVA SOFIE Concat Op - not supporting input param dimensions for concatenation axis. Input shape is " +
 
  126                        throw std::runtime_error(
"TMVA SOFIE Concat Op - input tensors have wrong shapes " +
 
  141               throw std::runtime_error(
"TMVA SOFIE Concat Op - stacking (i.e. COncatFromSequence with new_axis=1) is not supported ");
 
 
  149                  throw std::runtime_error(
"TMVA SOFIE Concat Op Input Tensor " + it + 
" is not found in model");
 
 
  198                  throw std::runtime_error(
"TMVA SOFIE Concat called to Generate without being initialized first");
 
  200            std::stringstream out;
 
  201            out<<
"\n//--------- Concat\n";
 
  204            for(
int i = 0; i<
fAxis; ++i){
 
  212               for(
size_t i=0; i<
fInputs.size(); ++i) {
 
  229               for (
int i = 0; i < 
fAxis; ++i) {
 
  231                  out << 
SP << 
"for (size_t i" << i << 
" = 0; i" << i << 
" < " << 
fOutputShape[i].GetVal() << 
"; ++i" << i <<
") {\n";
 
  234               out << 
SP << 
SP << 
SP << 
"int idxOut = ";
 
  235               for (
int k = 0; k < 
fAxis; k++) {
 
  236                  if (k > 0) out << 
" + ";
 
  237                  out << 
outStride[k].GetVal() << 
"*i" << k;
 
  244                  out << 
SP << 
SP << 
SP << 
"int idxIn" << 
j <<
" = ";
 
  245                  for (
int k = 0; k < 
fAxis; k++) {
 
  246                     if (k > 0) out << 
" + ";
 
  251                  out << 
SP << 
SP << 
SP << 
SP << 
"tensor_" << 
fOutput << 
"[idxOut+iC] = tensor_" << 
fInputs[
j] << 
"[idxIn" << 
j << 
"+iC];\n";
 
  252                  out << 
SP << 
SP << 
SP << 
"}\n";
 
  255                for (
int i = 0; i < 
fAxis; ++i) {
 
 
 
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 WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
 
const_iterator begin() const
 
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
 
bool CheckIfTensorAlreadyExist(std::string tensor_name)
 
void AddConstantTensor(std::string tensor_name, ETensorType type, std::vector< std::size_t > shape, std::shared_ptr< void > data)
 
const ETensorType & GetTensorType(std::string name) const
 
bool IsInitializedTensor(const std::string &name) const
 
const std::vector< size_t > & GetTensorShape(std::string name) const
 
std::shared_ptr< void > GetInitializedTensorData(std::string tensor_name)
 
std::vector< Dim > GetDynamicTensorShape(std::string name) const
 
void SetNotWritableInitializedTensor(const std::string &tensor_name)
 
std::vector< std::string > fInputs
 
std::vector< Dim > fOutputShape
 
std::vector< std::vector< Dim > > fInputShapes
 
ROperator_Concat(std::vector< std::string > inputs, int axis, int newAxis, std::string output)
 
std::vector< ETensorType > TypeInference(std::vector< ETensorType > input) override
 
std::string Generate(std::string OpName) override
 
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > > inputs) override
 
void Initialize(RModel &model) override
 
std::vector< std::vector< Dim > > ShapeInference(const std::vector< std::vector< Dim > > &inputs)
 
std::vector< std::string_view > fInputTensorNames
 
bool fIsOutputConstant
flag to identify if operator has a constant output (no need to generate code)
 
const std::string SP
space used to correctly indent the generated C++ code
 
std::vector< std::string_view > fOutputTensorNames
 
std::string Clean_name(std::string input_tensor_name)
 
std::vector< size_t > ComputeStrideFromShape(const std::vector< size_t > &shape)
compute stride of a tensor given its shape (assume layout is row-major)
 
std::string ConvertDynamicShapeToLength(std::vector< Dim > shape)
 
std::string ConvertValuesToString(size_t n, const T *data)
 
std::string ConvertShapeToString(std::vector< size_t > shape)
 
std::string ConvertDynamicShapeToString(std::vector< Dim > shape)
 
std::vector< size_t > ConvertShapeToInt(std::vector< Dim > shape)
Convert shape based on Dim to integer format.
 
std::size_t ConvertShapeToLength(std::vector< size_t > shape)
 
create variable transformations