class_docstr: Calculates how often predictions equal labels.
  
  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 `binary 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.Accuracy()
  >>> m.update_state([[1], [2], [3], [4]], [[0], [2], [3], [4]])
  >>> m.result()
  0.75
  
  >>> m.reset_state()
  >>> m.update_state([[1], [2], [3], [4]], [[0], [2], [3], [4]],
  ...                sample_weight=[1, 1, 0, 0])
  >>> m.result()
  0.5
  
  Usage with `compile()` API:
  
  ```python
  model.compile(optimizer='sgd',
                loss='binary_crossentropy',
                metrics=[keras.metrics.Accuracy()])
  ```
class_docstr_tok: ["Calculates","how","often","predictions","equal","labels",".","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","`","binary","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.Accuracy","(",")",">",">",">","m.update_state","(","[","[","1","]",",","[","2","]",",","[","3","]",",","[","4","]","]",",","[","[","0","]",",","[","2","]",",","[","3","]",",","[","4","]","]",")",">",">",">","m.result","(",")","0.75",">",">",">","m.reset_state","(",")",">",">",">","m.update_state","(","[","[","1","]",",","[","2","]",",","[","3","]",",","[","4","]","]",",","[","[","0","]",",","[","2","]",",","[","3","]",",","[","4","]","]",",","...","sample_weight=","[","1",",","1",",","0",",","0","]",")",">",">",">","m.result","(",")","0.5","Usage","with","`","compile","(",")","`","API",":","``","`","python","model.compile","(","optimizer='sgd","'",",","loss='binary_crossentropy","'",",","metrics=","[","keras.metrics.Accuracy","(",")","]",")","``","`"]
code: def __init__(self, name="accuracy", dtype=None):
      super().__init__(fn=accuracy, name=name, dtype=dtype)
      # Metric should be maximized during optimization.
      self._direction = "up"
  
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 1 to create a new Accuracy object from inherited base classes: reduction_metrics with example: obj = Accuracy(name, dtype)