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 to reduce, can be negative.
  • top_k (int, optional, default=1) The top-k accuracy to compute.
  • ignore_index (int, optional) The ignored value of target.
Returns:

dragon.Tensor The output tensor.