The details of the code here could be referred from the paper titled: AdvNF: Reducing mode collapse in conditional normalising flows using adversarial learning. The link for the same has been shared below. https://scipost.org/SciPostPhys.16.5.132/pdf