Creating a custom layer in tensorflow
I'm trying to create a layer in TensorFlow, which works something like this:
And my implementation looks something, like this:
class BinaryLayer(Layer):
def __init__(self):
super(BinaryLayer, self).__init__()
def build(self, input_shape):
w_init = 0.5
self.w = tf.Variable(name=kernel, initial_value=w_init(dtype='float32'),trainable=True)
def call(self, inputs):
return tf.math.greater(inputs, self.w)
But it gives me an error saying 'float' object is not callable
And I also think there will be another problem in the future, which is, it will return boolean
values, such as: [[TFT] [TTF] [FFT]]
, but I want something like this: [[101] [110] [001]]
Topic binary-classification tensorflow binary
Category Data Science