Solved by mariosasko in post #2 
              
              
                It seems good to me. 
You can use conditional indexing to make it even shorther. 
def get_accuracy(y_true, y_prob):
    accuracy = metrics.accuracy_score(y_true, y_prob > 0.5)
    return accuracy

If you want to work with Pytorch tensors, the same functionality can be achieved with the following cod…