I am trying to convert the following GRU layer from PyTorch(1.9.1) to TensorFlow(2.6.0):
# GRU layer
self.gru = nn.GRU(64, 32, bidirectional=True, num_layers=2, dropout=0.25, batch_first=True)
I am unsure about my current implementation, especially regarding the conversion of the parameters bidirectional and num_layers. My current reconstruction is the following:
# GRU Layer
model.add(Bidirectional(GRU(32, return_sequences=True, dropout=0.25, time_major=False)))
model.add(Bidirectional(GRU(32, return_sequences=True, dropout=0.25, time_major=False)))
Am I missing something? Thanks for your help in advance!
yes these two models are the same, at least from the number of parameters and the output shape point of view: In pytorch:
In Tensorflow: