1#ifndef TMVA_SOFIE_ROPERATOR_Custom
2#define TMVA_SOFIE_ROPERATOR_Custom
10namespace Experimental{
27 ROperator_Custom(std::string OpName, std::vector<std::string>Inputs, std::vector<std::string>Outputs, std::vector<std::vector<std::size_t>> OutputShapes, std::string HeaderName){
34 for(
auto& it:Outputs){
39 std::vector<std::vector<size_t>>
ShapeInference(std::vector<std::vector<size_t>>) {
return {{}};};
40 std::vector<ETensorType>
TypeInference(std::vector<ETensorType>){
return {};};
46 throw std::runtime_error(
"TMVA SOFIE Custom " +
fOpName +
" Op Input Tensor " + it +
" is not found in model");
51 throw std::runtime_error(
"TMVA SOFIE Custom "+
fOpName +
" Op was not intialized with the names/shapes of all the output tensors");
59 std::cout <<
"Custom operator using " <<
fHeaderName;
61 std::cout <<
" ---> ";
68 OpName =
"op_" + OpName;
69 std::stringstream out;
70 out <<
"\n//------ "<<
fOpName<<
" \n";
72 for(
long unsigned int i = 0; i<
fInputNames.size(); ++i){
76 for(
long unsigned int i = 0; i<
fOutputNames.size(); ++i){
80 out <<
SP <<
fOpName<<
"::Compute("+args+
");\n";
void AddNeededCustomHeader(std::string filename)
void AddIntermediateTensor(std::string tensor_name, ETensorType type, std::vector< Dim > dim_shape)
bool CheckIfTensorAlreadyExist(std::string tensor_name)
void UpdateOutputTensorList(std::vector< std::string > curr_output_tensor, std::vector< std::string > modify_output_tensor)
ROperator_Custom(std::string OpName, std::vector< std::string >Inputs, std::vector< std::string >Outputs, std::vector< std::vector< std::size_t > > OutputShapes, std::string HeaderName)
std::string Generate(std::string OpName)
std::vector< std::string > fOutputNames
std::vector< ETensorType > TypeInference(std::vector< ETensorType >)
std::vector< std::vector< size_t > > ShapeInference(std::vector< std::vector< size_t > >)
std::vector< std::vector< std::size_t > > fOutputShapes
void Initialize(RModel &model)
std::vector< std::string > fInputNames
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