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;
R__EXTERN TSystem * gSystem
void PrintIntermediateTensors()
void OutputGenerated(std::string filename="", bool append=false)
void PrintInitializedTensors()
void Generate(std::underlying_type_t< Options > options, int batchSize=-1, long pos=0, bool verbose=false)
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 "Python3" is installed,...