As a follow-up from this question:
Concatenate input with constant vector in keras
I am trying to use the suggested solution:
constant=K.variable(np.ones((1,10, 5)))
constant = K.repeat_elements(constant,rep=batch_size,axis=0)
And got the following Error:
NameError: name 'batch_size' is not defined
I do not see how one define within the keras model the batch_size [not explicitly] so that one can concatenate a symbolic layer and a constant layer in order to use them as an input layer.
To get the dynamic batch size:
But
K.repeat_elements()
doesn't acceptTensor
values forrep
. You can however produce the same result usingK.tile()
: