C5W4A1 No Softmax function provided?

In Exercise 3 (scaled_dot_product_attention), there is a step for computing the softmax() for the attention formula.

However, error says “softmax is not defined”, and I look at the Lab Files and couldn’t find it implemented in any of the files. It was usually provided in the past, is there a file missing?

Thanks,

Since we are using TensorFlow for this lab, you can use the default one in the TF library: tf.keras.activations.softmax

Either import it (1) or use the fully qualified version (2):

(1) from tensorflow.keras.activations import softmax
(2) attention_weights = tf.keras.activations.softmax(…)

Ah, that’s awesome, thanks so much!!