Solved by albanD in post #2 
              
              
                Hi, 
You can re-use the original result to create a new instance of the same class: 
out = torch.mode(inp)
final_out = out.__class__(new_values)