pub fn tensor_accuracy<B>(
logits: &Tensor<B>,
targets: &Tensor<B>,
) -> Result<f64, Error>where
B: Backend,Expand description
Compute accuracy directly from logit tensors and one-hot/class-index targets.
- If
targetshas shape [batch, n_classes] (one-hot), takes argmax of both. - If
targetshas shape [batch] or [batch, 1], treats as class indices.