I want to apply a
KerasLayer object to an input sequence with shape
(batch_size, seq_len, n_features). If I use a TF2/Keras
Dense(output_dim) layer, the same weights are applied to each element of the sequence. However, if the layer is a PennyLane’s
KerasLayer, I get an error :
ValueError: 'features' must be of shape (4,) or smaller; got (64, 4).
where 4=number of qubits, 64=sequence length.
I can fix this temporarily by doing something like:
_, seq_len, _ = tf.shape(x) output = tf.convert_to_tensor([self.dense(x[:, t, :]) for t in range(seq_len)])
…but I wonder if it’s a problem from my side, or if broadcasting is not implemented yet.