I'm trying to use the output of a tf.keras.layers.Lambda function as the last layer in a tf.keras model, but tf is interpreting the lambda layer's output as a Tensor(as opposed to a Layer) object.
The error is: "ValueError: Output tensors to a Model must be the output of a TensorFlow Layer
(thus holding past layer metadata). Found: Tensor("Discriminator/mullayer/mul:0", shape=(2, 2), dtype=float32)"
and the code is attached below
from tensorflow.contrib.keras import layers, models
#lots of stuff up here, all working fine...
logits = layers.Dense(1, name=name+'fc')(x)# x works fine
mullayer = layers.Lambda(lambda x: x * self.alphaVal,name = "mullayer")
test = tf.constant([1.0],shape = (2,2))
testOut = mullayer(test)
outputs = [logits, testOut]
self.disc = models.Model(inputs=inp, outputs=outputs)
'self.alphaVal' is not a keras variable, just a float, which I suspect may be part of the problem. If so, what is the equivalent of keras' backend K in tf.keras?
Thanks