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.6782
Epoch 2/5 - average loss: 0.6556
Epoch 3/5 - average loss: 0.6431
Epoch 4/5 - average loss: 0.6339
Epoch 5/5 - average loss: 0.6293
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.27042633295059204 using PyTorch = 0.27042633
input to model is [1.0965776 0.9103265 1.9756684 1.3508093 1.3468878 1.4005579 1.1609015]
-> output using SOFIE = 0.39927685260772705 using PyTorch = 0.39927685
input to model is [0.846992 0.9408182 0.98906 1.6148995 1.038698 1.2381754 1.0323234]
-> output using SOFIE = 0.6307218074798584 using PyTorch = 0.63072187
input to model is [1.897264 1.234499 0.98704207 0.708829 0.7279103 0.9053675
0.76521254]
-> output using SOFIE = 0.5393198728561401 using PyTorch = 0.5393199
input to model is [0.791873 0.9792347 0.9924756 0.9159218 1.1000326 0.94064647
0.79085195]
-> output using SOFIE = 0.5081952214241028 using PyTorch = 0.5081953
input to model is [0.9692043 0.6372814 0.9850732 0.9201175 0.72131383 0.8001433
0.7160924 ]
-> output using SOFIE = 0.5554959177970886 using PyTorch = 0.5554959
input to model is [1.5037444 1.1279533 0.9814414 1.5327642 0.7886151 1.1838427 1.0383142]
-> output using SOFIE = 0.5453738570213318 using PyTorch = 0.54537386
input to model is [1.2042431 1.0750061 1.5724212 1.1590953 1.367509 1.1043229
0.99204683]
-> output using SOFIE = 0.3828982412815094 using PyTorch = 0.38289824
input to model is [1.012179 0.76250947 0.9957243 0.48331824 0.4295301 0.55478483
0.7100585 ]
-> output using SOFIE = 0.3829401731491089 using PyTorch = 0.38294017
input to model is [0.8616951 1.1908345 0.99018383 1.2523934 1.1448306 1.0246366
0.9923519 ]
-> output using SOFIE = 0.5372459292411804 using PyTorch = 0.5372459
OK