Solved by ptrblck in post #2 
              
              
                I don’t think there is a built-in total_variation method in torchvision, but based on the TF implementatio you could use try to use the same approach as it looks quite simple.