15os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n\ 
   18from tensorflow.keras.models import Model\n\ 
   19from tensorflow.keras.layers import Input,Dense,Activation,ReLU\n\ 
   20from tensorflow.keras.optimizers import SGD\n\ 
   22input=Input(shape=(64,),batch_size=4)\n\ 
   24x=Activation('relu')(x)\n\ 
   25x=Dense(16,activation='relu')(x)\n\ 
   26x=Dense(8,activation='relu')(x)\n\ 
   29model=Model(inputs=input,outputs=output)\n\ 
   31randomGenerator=np.random.RandomState(0)\n\ 
   32x_train=randomGenerator.rand(4,64)\n\ 
   33y_train=randomGenerator.rand(4,4)\n\ 
   35model.compile(loss='mean_squared_error', optimizer=SGD(learning_rate=0.01))\n\ 
   36model.fit(x_train, y_train, epochs=5, batch_size=4)\n\ 
   37model.save('KerasModel.h5')\n";
 
   40void TMVA_SOFIE_Keras(
const char * modelFile = 
nullptr, 
bool printModelInfo = 
true){
 
   45    if (modelFile == 
nullptr) {
 
   48        m.SaveSource(
"make_keras_model.py");
 
   50        modelFile = 
"KerasModel.h5";
 
   62     if (!printModelInfo) 
return;
 
   77    std::cout<<
"\n\nTensor \"dense2bias0\" already exist: "<<std::boolalpha<<model.
CheckIfTensorAlreadyExist(
"dense2bias0")<<
"\n\n";
 
   78    std::vector<size_t> tensorShape = model.
GetTensorShape(
"dense2bias0");
 
   79    std::cout<<
"Shape of tensor \"dense2bias0\": ";
 
   80    for(
auto& it:tensorShape){
 
   83    std::cout<<
"\n\nData type of tensor \"dense2bias0\": ";
 
   85    std::cout<<SOFIE::ConvertTypeToString(tensorType);
 
R__EXTERN TSystem * gSystem
const ETensorType & GetTensorType(std::string name)
void PrintIntermediateTensors()
bool CheckIfTensorAlreadyExist(std::string tensor_name)
void PrintInitializedTensors()
void OutputGenerated(std::string filename="")
const std::vector< size_t > & GetTensorShape(std::string name)
void Generate(std::underlying_type_t< Options > options, int batchSize=1)
void PrintRequiredInputTensors()
static void PyInitialize()
Initialize Python interpreter.
Class supporting a collection of lines with C++ code.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
TString Python_Executable()
Function to find current Python executable used by ROOT If Python2 is installed return "python" Inste...