Accuracy
Parameters
dim
The dimension along which to find the predicted class (default: -1, last dimension)
threshold
Optional threshold for binary classification. If provided, predictions > threshold are classified as class 1, otherwise class 0. Only applicable when dim size is 1 or 2.