Some useful code for working with pytorch. Please see Deep Learning with Pytorch by Stevens, Antiga, and Viehmann for source material