I want to use some ConvLSTM2D layer for a multi output regression model. One image should be the input and depending on the image a certain number of values should be the output padded by zeros. My Question is what function to use to have the same image as an input?
If I'm using
import keras.backend as K
K.tile(input, number_timesteps)
I'm getting the error: AttributeError:'Tensor' object has no attribute '_keras_history'. Is there any other way to solve this or do I have to input the same image multiple times?
All keras tensors in a model must be produced by a Layer
.
When you use backend functions, you're not using layers.
You can use Lambda
layers to wrap custom and backend functions:
tiledOutputs = Lambda(lambda x: K.tile(x, number_timesteps))(imageInputs)
Or add the layer to a sequential model:
model.add(Lambda(lambda x: K.tile(x, number_timesteps)))
But you're probably looking for K.stack([x]*number_timesteps, axis=1)
.