SparseCategoricalCrosstentropy vs sparse_categorical_crossentropy
SparseCategoricalCrossentropy is a class. So you have to define a object first then you can compute the loss using it.
scce = tf.keras.losses.SparseCategoricalCrossentropy()
scce(y_true, y_pred).numpy()

While sparse_categorical_crossentropy is merely a function which can be directly used to compute cost.
loss = tf.keras.losses.sparse_categorical_crossentropy(y_true, y_pred)

If you are to pass the loss to a Sequential API then you must pass the object ,not the function.
model.compile('sgd', loss=tf.keras.losses.SparseCategoricalCrossentropy())