class_docstr: Calculates how often predictions matches integer labels.
  
  For example, if `y_true` is torch.tensor([[0, 0, 1], [0, 1, 0]]) and `y_pred` is
  torch.tensor([[0.1, 0.9, 0.8], [0.05, 0.95, 0]]) then the categorical accuracy is 1/2 or .5.
  If the weights were specified as tensor([0.7, 0.3]) then the categorical accuracy
  would be .3. You can provide logits of classes as `y_pred`, since argmax of
  logits and probabilities are same.
  
  Usage:
  
  ```python
  pred = torch.tensor([[0.1, 0.9, 0.8], [0.05, 0.95, 0]])
  target = torch.tensor([[0, 0, 1], [0, 1, 0]])
  cacc = CategoricalAccuracy()
  cacc(pred, target)
  ```
class_docstr_tok: ["Calculates","how","often","predictions","matches","integer","labels",".","For","example",",","if","`","y_true","`","is","torch.tensor","(","[","[","0",",","0",",","1","]",",","[","0",",","1",",","0","]","]",")","and","`","y_pred","`","is","torch.tensor","(","[","[","0.1",",","0.9",",","0.8","]",",","[","0.05",",","0.95",",","0","]","]",")","then","the","categorical","accuracy","is","1\/2","or",".5",".","If","the","weights","were","specified","as","tensor","(","[","0.7",",","0.3","]",")","then","the","categorical","accuracy","would","be",".3",".","You","can","provide","logits","of","classes","as","`","y_pred","`",",","since","argmax","of","logits","and","probabilities","are","same",".","Usage",":","``","`","python","pred","=","torch.tensor","(","[","[","0.1",",","0.9",",","0.8","]",",","[","0.05",",","0.95",",","0","]","]",")","target","=","torch.tensor","(","[","[","0",",","0",",","1","]",",","[","0",",","1",",","0","]","]",")","cacc","=","CategoricalAccuracy","(",")","cacc","(","pred",",","target",")","``","`"]
code: def compute(self):
      return self.correct.float() / self.total
  
imports: import torch
  from abc import ABC, abstractmethod
label_desc: Use image node_id 3 for calling the CategoricalAccuracy obj's underlying member method code with example usage: obj.compute() and returns: unknown