Skip to content

Commit

Permalink
API docs: Fix usage example format in to_categorical.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 291802325
Change-Id: Ibeefcaf377adfad82b4e0a2c4585c50c88034ad7
  • Loading branch information
pavithrasv authored and tensorflower-gardener committed Jan 27, 2020
1 parent a02fa19 commit f7bbe17
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tensorflow/python/keras/utils/np_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ def to_categorical(y, num_classes=None, dtype='float32'):
E.g. for use with categorical_crossentropy.
Usage Example:
>>> y = [0, 1, 2, 3]
>>> tf.keras.utils.to_categorical(y, num_classes=4)
array([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]], dtype=float32)
>>> y = [0, 1, 2, 3]
>>> tf.keras.utils.to_categorical(y, num_classes=4)
array([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]], dtype=float32)
Arguments:
y: class vector to be converted into a matrix
Expand Down

0 comments on commit f7bbe17

Please sign in to comment.