The code here is based on genekogan's neural-style-pt histogram loss code. The CUDA code comes from pierre-wilmot's code here: https://github.com/pierre-wilmot/NeuralTextureSynthesis
Each histogram loss layer stores the style image's histogram as a target, and then uses that compute the difference to the image being stylized.