class_docstr: Calculates how often predictions match integer labels.
  
  ```python
  acc = np.dot(sample_weight, np.equal(y_true, np.argmax(y_pred, axis=1))
  ```
  
  You can provide logits of classes as `y_pred`, since argmax of
  logits and probabilities are same.
  
  This metric creates two local variables, `total` and `count` that are used
  to compute the frequency with which `y_pred` matches `y_true`. This
  frequency is ultimately returned as `sparse categorical accuracy`: an
  idempotent operation that simply divides `total` by `count`.
  
  If `sample_weight` is `None`, weights default to 1.
  Use `sample_weight` of 0 to mask values.
  
  Args:
      name: (Optional) string name of the metric instance.
      dtype: (Optional) data type of the metric result.
  
  Standalone usage:
  
  >>> m = keras.metrics.SparseCategoricalAccuracy()
  >>> m.update_state([[2], [1]], [[0.1, 0.6, 0.3], [0.05, 0.95, 0]])
  >>> m.result()
  0.5
  
  >>> m.reset_state()
  >>> m.update_state([[2], [1]], [[0.1, 0.6, 0.3], [0.05, 0.95, 0]],
  ...                sample_weight=[0.7, 0.3])
  >>> m.result()
  0.3
  
  Usage with `compile()` API:
  
  ```python
  model.compile(optimizer='sgd',
                loss='sparse_categorical_crossentropy',
                metrics=[keras.metrics.SparseCategoricalAccuracy()])
  ```
class_docstr_tok: ["Calculates","how","often","predictions","match","integer","labels",".","``","`","python","acc","=","np.dot","(","sample_weight",",","np.equal","(","y_true",",","np.argmax","(","y_pred",",","axis=1",")",")","``","`","You","can","provide","logits","of","classes","as","`","y_pred","`",",","since","argmax","of","logits","and","probabilities","are","same",".","This","metric","creates","two","local","variables",",","`","total","`","and","`","count","`","that","are","used","to","compute","the","frequency","with","which","`","y_pred","`","matches","`","y_true","`",".","This","frequency","is","ultimately","returned","as","`","sparse","categorical","accuracy","`",":","an","idempotent","operation","that","simply","divides","`","total","`","by","`","count","`",".","If","`","sample_weight","`","is","`","None","`",",","weights","default","to","1",".","Use","`","sample_weight","`","of","0","to","mask","values",".","Args",":","name",":","(","Optional",")","string","name","of","the","metric","instance",".","dtype",":","(","Optional",")","data","type","of","the","metric","result",".","Standalone","usage",":",">",">",">","m","=","keras.metrics.SparseCategoricalAccuracy","(",")",">",">",">","m.update_state","(","[","[","2","]",",","[","1","]","]",",","[","[","0.1",",","0.6",",","0.3","]",",","[","0.05",",","0.95",",","0","]","]",")",">",">",">","m.result","(",")","0.5",">",">",">","m.reset_state","(",")",">",">",">","m.update_state","(","[","[","2","]",",","[","1","]","]",",","[","[","0.1",",","0.6",",","0.3","]",",","[","0.05",",","0.95",",","0","]","]",",","...","sample_weight=","[","0.7",",","0.3","]",")",">",">",">","m.result","(",")","0.3","Usage","with","`","compile","(",")","`","API",":","``","`","python","model.compile","(","optimizer='sgd","'",",","loss='sparse_categorical_crossentropy","'",",","metrics=","[","keras.metrics.SparseCategoricalAccuracy","(",")","]",")","``","`"]
code: def get_config(self):
      return {"name": self.name, "dtype": self.dtype}
  
imports: from keras import backend
  from keras import ops
  from keras.api_export import keras_export
  from keras.losses.loss import squeeze_to_same_rank
  from keras.metrics import reduction_metrics
label_desc: Use image node_id 2 for calling the SparseCategoricalAccuracy obj's underlying member method code with example usage: obj.get_config() and returns: dict