I try to custom-design a network architecture that I can have a layer as follows:
x = k.Input(shape=(1,))
y = k.layers.Dense(1)(x + 1) #k.backend.constant(1) -- no difference
Fx = k.models.Model(x, y)
While "x+1" is a correct Tensorflow operation, however, I get the NoneType error:
AttributeError: 'NoneType' object has no attribute '_inbound_nodes'
When I try to use the Lambda layer to circumvent this situation, I get the same error:
x = k.Input(shape=(1,))
xx = k.layers.Lambda(lambda x: x[0] + x[1])(
[x, k.backend.constant(1, shape=(1,1))]
)
y = k.layers.Dense(1)(xx)
Fx = k.models.Model(x, y)
I however can hack through this by doing:
x = k.Input(shape=(1,))
xx = k.layers.Lambda(lambda x: x[0]+1)([x, x])
y = k.layers.Dense(1)(xx)
Fx = k.models.Model(x, y)
Because Tensor+(int or float) is a legitimate Tensorflow operation.
Am I making a mistake in defining the Lambda layer or this is a bug on Keras end?