The trained model is saved as HiggsModel.onnx and is used as input by other SOFIE tutorials (e.g. TMVA_SOFIE_RDataFrame.C), so this macro needs to be run before them.
size of data 10000
Sequential(
(0): Linear(in_features=7, out_features=64, bias=True)
(1): ReLU()
(2): Linear(in_features=64, out_features=64, bias=True)
(3): ReLU()
(4): Linear(in_features=64, out_features=1, bias=True)
(5): Sigmoid()
)
Epoch 1/5 - average loss: 0.6715
Epoch 2/5 - average loss: 0.6471
Epoch 3/5 - average loss: 0.6369
Epoch 4/5 - average loss: 0.6282
Epoch 5/5 - average loss: 0.6301
calling torch.onnx.export with parameters {'input_names': ['input'], 'output_names': ['output'], 'external_data': False, 'dynamo': True}
[torch.onnx] Obtain model graph for `Sequential([...]` with `torch.export.export(..., strict=False)`...
[torch.onnx] Obtain model graph for `Sequential([...]` with `torch.export.export(..., strict=False)`... ✅
[torch.onnx] Run decompositions...
[torch.onnx] Run decompositions... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
[torch.onnx] Optimize the ONNX graph...
[torch.onnx] Optimize the ONNX graph... ✅
model exported to ONNX as HiggsModel.onnx
input to model is [1.3551283 1.0198661 0.98278755 0.5504138 1.2055093 0.91609305
0.93084896]
-> output using SOFIE = 0.32207491993904114 using PyTorch = 0.32207492
input to model is [1.0965776 0.9103265 1.9756684 1.3508093 1.3468878 1.4005579 1.1609015]
-> output using SOFIE = 0.5153125524520874 using PyTorch = 0.51531255
input to model is [0.846992 0.9408182 0.98906 1.6148995 1.038698 1.2381754 1.0323234]
-> output using SOFIE = 0.5877813100814819 using PyTorch = 0.5877813
input to model is [1.897264 1.234499 0.98704207 0.708829 0.7279103 0.9053675
0.76521254]
-> output using SOFIE = 0.5718671083450317 using PyTorch = 0.5718671
input to model is [0.791873 0.9792347 0.9924756 0.9159218 1.1000326 0.94064647
0.79085195]
-> output using SOFIE = 0.5007792115211487 using PyTorch = 0.5007792
input to model is [0.9692043 0.6372814 0.9850732 0.9201175 0.72131383 0.8001433
0.7160924 ]
-> output using SOFIE = 0.5492246747016907 using PyTorch = 0.5492246
input to model is [1.5037444 1.1279533 0.9814414 1.5327642 0.7886151 1.1838427 1.0383142]
-> output using SOFIE = 0.5529407262802124 using PyTorch = 0.5529407
input to model is [1.2042431 1.0750061 1.5724212 1.1590953 1.367509 1.1043229
0.99204683]
-> output using SOFIE = 0.44583791494369507 using PyTorch = 0.44583791
input to model is [1.012179 0.76250947 0.9957243 0.48331824 0.4295301 0.55478483
0.7100585 ]
-> output using SOFIE = 0.32368960976600647 using PyTorch = 0.3236896
input to model is [0.8616951 1.1908345 0.99018383 1.2523934 1.1448306 1.0246366
0.9923519 ]
-> output using SOFIE = 0.524616003036499 using PyTorch = 0.524616
OK