
<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
two different ways to implement categorical cross entropy in TensorFlow

<ASSISTANT_TASK:>
Python Code::
import tensorflow as tf
from tensorflow.keras.losses import CategoricalCrossentropy
y_true = [[0, 1, 0], [1, 0, 0]]
y_pred = [[0.15, 0.75, 0.1], [0.75, 0.15, 0.1]]
cross_entropy_loss = CategoricalCrossentropy()
print(cross_entropy_loss(y_true, y_pred).numpy())
import tensorflow as tf
from tensorflow.keras.losses import SparseCategoricalCrossentropy
y_true = [1, 0]
y_pred = [[0.15, 0.75, 0.1], [0.75, 0.15, 0.1]]
cross_entropy_loss = SparseCategoricalCrossentropy()
loss = cross_entropy_loss(y_true, y_pred).numpy()

<END_TASK>
