Skip to content

Fixed ordering bug in the random numbers given to the GAN in FastCaloGAN

Henry Day-Hall requested to merge hdayhall/athena:23.0_fix_order into 23.0

In my previous code from MR !63562 (merged) there was a bug in the ordering of random inputs for the GAN.

The GAN for FastCaloGan takes 3 conditioning variables, and 50 random numbers. It can be stored as an ONNX file or an LWTNN file. When entering the random numbers for the ONNX file, my code was sorting the nodes alphabetically rather than numerically. This lead to the same physics (as the random numbers are all drawn from the same distribution), but gave different random fluctuations when the model was run as ONNX or LWTNN. It is equivalent to changing the random seed.

To verify conversions between ONNX and LWTNN it's best if they have the same random numbers. There is still some difference in the 8th decimal place between the output of ONNX and LWTNN, due to differences in internal precision. This is unavoidable.

Evidence of the fix;


Merge request reports