Skip to content

Commit a9688b4

Browse files
Fix: Update SparseCategoricalCrossentropy example (#21427)
1 parent d55a767 commit a9688b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

keras/src/losses/losses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,8 @@ class SparseCategoricalCrossentropy(LossFunctionWrapper):
11831183
11841184
Examples:
11851185
1186-
>>> y_true = [1, 2]
1187-
>>> y_pred = [[0.05, 0.95, 0], [0.1, 0.8, 0.1]]
1186+
>>> y_true = np.array([1, 2])
1187+
>>> y_pred = np.array([[0.05, 0.95, 0], [0.1, 0.8, 0.1]])
11881188
>>> # Using 'auto'/'sum_over_batch_size' reduction type.
11891189
>>> scce = keras.losses.SparseCategoricalCrossentropy()
11901190
>>> scce(y_true, y_pred)

0 commit comments

Comments
 (0)