I am trying to implement a custom activation function in Keras The function is following
def picewise(x):
if x > 0.5 :
return 1
elif if x < 0.5:
return 0
else:
return x + 0.5
I call the activation function as
model.add(Dense(128,activation = picewise))
But I am getting a whole bunch of errors. How can i successfully implement the above as a working activation function in Keras