Solved by brookisme in post #2 
              
              
                Just remembered this question was dangling.  My solution is below.  It works on tensors or np.arrays without any changes.  I’ve also added methods for precision/recall and all-of-the-above. 
Note: Two divide by zero’s can occur when calculating precision and recall.  (1) when you have 100% true-nega…