def calc_accuracy(out, true):
    """Compute total accuracy of output of NN (CrossEntropyLoss-like)."""
    prediction = out.min(axis=1).indices.flatten()
    return (prediction == true.flatten()).sum().item() / len(prediction)