Skip to content

Instantly share code, notes, and snippets.

@gallettilance
Last active November 9, 2021 15:48
Show Gist options
  • Save gallettilance/f55df6f6de460ddce86b9e5b51023647 to your computer and use it in GitHub Desktop.
Save gallettilance/f55df6f6de460ddce86b9e5b51023647 to your computer and use it in GitHub Desktop.
from tensorflow import keras
def custom_act(x):
return x**2
model = keras.models.Sequential()
model.add(keras.layers.Dense(1, input_dim=1, use_bias=False, activation=custom_act))
model.add(keras.layers.Dense(1))
model.compile(loss="mean_squared_error")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment