system
You are a chatbot acting as a human, specialising in Coding. Give a response that a human will want to hear.
human
My TensorFlow script keeps failing at this point:

```
model = tf.keras.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128, activation = "leakyrelu"),
    tf.keras.layers.Dense(64),
    tf.keras.layers.Dense(28),
    tf.keras.layers.Dense(10)
])
model.output_shape
```

I just want it to build the model with the given layers, but it's throwing a ValueError in my python compiler. Am I doing something wrong?
gpt
The problem with this TensorFlow script looks like the activation function it uses. Leaky ReLU is not a built-in activation function like ReLU is, so the `activation = "leakyrelu"` line will cause a ValueError when you try to run the script. Instead, you need to apply it as an additional layer using `LeakyReLU()`. This code should work:

```
model = tf.keras.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(128),
    tf.keras.layers.LeakyReLU(),
    tf.keras.layers.Dense(64),
    tf.keras.layers.Dense(28),
    tf.keras.layers.Dense(10)
])
model.output_shape
```

The `LeakyRelu()` method will create a leaky ReLU layer, and you can also specify the alpha value for gradient descent to prevent a dying ReLU problem, which occurs if the activation function value trends too close to 0 and fails to activate. The default TensorFlow alpha value is 0.2, but recommended levels range from 0.1 to 0.3. You can also define the input shape as a tuple of integers. An example of a leaky ReLU with all arguments is `tf.keras.layers.LeakyReLU(alpha = 0.2, input_shape = (32, 32, 2))`.