(y_true, y_pred)
| 2745 | |
| 2746 | |
| 2747 | def accuracy(y_true, y_pred): |
| 2748 | [y_pred, y_true], _ = \ |
| 2749 | metrics_utils.ragged_assert_compatible_and_get_flat_values( |
| 2750 | [y_pred, y_true]) |
| 2751 | y_pred.shape.assert_is_compatible_with(y_true.shape) |
| 2752 | if y_true.dtype != y_pred.dtype: |
| 2753 | y_pred = math_ops.cast(y_pred, y_true.dtype) |
| 2754 | return math_ops.cast(math_ops.equal(y_true, y_pred), K.floatx()) |
| 2755 | |
| 2756 | |
| 2757 | @keras_export('keras.metrics.binary_accuracy') |
no test coverage detected