The answer to this question is generally to implement it as a new layer and do
layer = Dense(num_neurones)(previous_layer) out = TheActivationFunction()(layer)
as described here.
However, I want to use it for an LSTM cell, like this
LSTM(units = num_units, activation = TheActivationFunction(), return_sequences = True)
Specifically, I would like to implement the function x -> tanh(beta * x) with beta a learnable parameter.