Hi,
I think this post can answer your questions:

  
    
    
    [solved] Discrete cosine transform implementation in pytorch? 
  
  
    UPDATE: I figured it out. This link explains how to incorporate scipy functions into the computational graph. You can use scipy.fftpack.dct http://pytorch.org/tutorials/advanced/numpy_extensions_tutorial.html 
Hi everyone, 
So I want to backprop the error gradient through the inverse discrete cosine transform. 
I tried implementing a naive versi 
on of the DCT but it was reallyyyyy slow. 
Does anyone have any suggestions for writing a fast, backpropable implementation of the inverse discrete cos…
  


Bests