Class: Tensorflow::Keras::Metrics::SparseCategoricalAccuracy

Inherits:
Mean
  • Object
show all
Defined in:
lib/tensorflow/keras/metrics/sparse_categorical_accuracy.rb

Instance Method Summary collapse

Methods inherited from Mean

#call, #initialize, #reset_states, #result

Constructor Details

This class inherits a constructor from Tensorflow::Keras::Metrics::Mean

Instance Method Details

#update_state(y_true, y_pred) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/tensorflow/keras/metrics/sparse_categorical_accuracy.rb', line 5

def update_state(y_true, y_pred)
  y_pred = RawOps.arg_max(y_pred, -1)

  # if y_pred.dtype != y_true.dtype
  #   y_pred = Tensorflow.cast(y_pred, y_true.dtype)
  # end

  super(Math.equal(y_true, y_pred))
end