IMAGINE torch neural network routines