uv_utna
uv_utna

Reputation: 63

Problem with a custom activation function - TypeError: argument of type 'Bind' is not iterable

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: enter image description here I am not sure about this error. Can anyone help me with this problem?

Thank you

Upvotes: 0

Views: 35

Answers (0)

Related Questions