accuracy

dragon.metrics.accuracy(
  inputs,
  axis=-1,
  top_k=1,
  ignore_index=None,
  **kwargs
)[source]

Compute the top-k accuracy.

Parameters:
  • inputs (Sequence[dragon.Tensor]) – The tensor logit and label.
  • axis (int, optional, default=-1) – The axis of classes.
  • top_k (int, optional, default=1) – The top-k accuracy to compute.
  • ignore_index (int, optional) – The label index to ignore.
Returns:

dragon.Tensor – The output tensor.