For anyone coming here from Google search: I have implemented DCT for pytorch in terms of the built-in FFT, so that it works on CPU and GPU, through back propagation:

  
      
      GitHub
  
  
    

zh217/torch-dct 382

DCT (discrete cosine transform) functions for pytorch - zh217/torch-dct