Skip to content

Commit

Permalink
docs: redirect deprecated function call (#19030)
Browse files Browse the repository at this point in the history
Replace deprecated keras.backend.categorical_crossentropy with keras.ops.categorical_crossentropy in the codebase.
  • Loading branch information
dugujiujian1999 authored Jan 7, 2024
1 parent 488f333 commit 85c9a58
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keras/utils/numerical_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def to_categorical(x, num_classes=None):
... .04, .01, .94, .05,
... .12, .21, .5, .17],
... shape=[4, 4])
>>> loss = keras.backend.categorical_crossentropy(a, b)
>>> loss = keras.ops.categorical_crossentropy(a, b)
>>> print(np.around(loss, 5))
[0.10536 0.82807 0.1011 1.77196]
>>> loss = keras.backend.categorical_crossentropy(a, a)
>>> loss = keras.ops.categorical_crossentropy(a, a)
>>> print(np.around(loss, 5))
[0. 0. 0. 0.]
"""
Expand Down

0 comments on commit 85c9a58

Please sign in to comment.