()
return base.Fn('_Accuracy', f)
Returns a layer that scores predicted versus target category.
Returns a layer that scores predicted versus target category.
Returns a layer that scores predicted versus target category .
def _Accuracy():
  """Returns a layer that scores predicted versus target category."""
  def f(predicted_category, target_category):  # pylint: disable=invalid-name
    # TODO(pkozakowski): This assertion breaks some tests. Fix and uncomment.
    # shapes.assert_same_shape(predicted_category, target_category)
    return jnp.equal(predicted_category, target_category).astype(jnp.float32)
  return base.Fn('_Accuracy', f)
def _Accuracy ( ) : def f ( predicted_category , target_category ) : # pylint: disable=invalid-name # TODO(pkozakowski): This assertion breaks some tests. Fix and uncomment. # shapes.assert_same_shape(predicted_category, target_category) return jnp . equal ( predicted_category , target_category ) . astype ( jnp . float32 ) return base . Fn ( '_Accuracy' , f )