I'm writing a VAE for sequence to sequence problem in keras. The decoder is an auto-regressive model so I have two different inputs, one for the encoder and the same (shifted by 1, but this is not the problem) for the decoder. I want also to do data augmentation so I decide to use the fit_generator() method but I have some problem on returning the two inputs.
I have tried to return a list of two input vector, like this
class DataGenerator(Sequence):
def __init__(....
def __getitem__(self, index):
data = create_data()
return [data, data]
or a dictionary like this
return {"encoder_input_name" : "data, decoder_input_name" : data }
where data is a numpy tensor of shape (batch_size, max_sequence_len, input_dimention).
I can't just use the same input layer because later the two input will be a little different, as I said the decoder input will be shifted by one with a different first element and other reasons.
When I return the list [data, data] or I have this error:
ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays
When I return the dictionary I have this error:
batch_size = x.shape[0]
AttributeError: 'str' object has no attribute 'shape'
How can I solve this issue?
Thank you very much!
EDIT
I changed the output of __getitem__
to
[inpuut_1, input_2], []
and it worked.