Reputation: 63
I am building auto-encoder and I want to encode my values into a logical matrix. I'm using my custom step activation function in the last layer as below:
@tf.custom_gradient
def binary_activation(x):
ones = tf.ones(tf.shape(x), dtype=x.dtype.base_dtype)
zeros = tf.zeros(tf.shape(x), dtype=x.dtype.base_dtype)
def grad(dy):
return ... # TODO define gradient
return keras.backend.switch(x > 0.5, ones, zeros), grad
However, after running few episodes, it will show error:
I am not sure about this error. Can anyone help me with this problem?
Thank you
Upvotes: 0
Views: 35