code: def update_state(self, y_true, y_pred, sample_weight=None):
      y_pred = ops.reshape(ops.argmax(y_pred, axis=1), (-1, 1))
      values = ops.cast(y_true, "int32") == ops.cast(y_pred, "int32")
      values = ops.cast(values, "float32")
      if sample_weight is not None:
          sample_weight = ops.cast(sample_weight, "float32")
          values = ops.multiply(values, sample_weight)
      self.true_positives.assign_add(ops.sum(values))
  
imports: import torch
  import tensorflow
  import os
  import numpy
  import keras
  from keras import layers
  from keras import ops
label_desc: Use image node_id 2 for calling the CategoricalTruePositives obj's underlying member method code with example usage: obj.update_state(y_true, y_pred, sample_weight) without return types