I am in the process of translating a Keras implementation to a PyTorch one. After the full conversion my model was not converging fast enough, although the loss did seem to be decreasing. As I was tracing back my steps, I noticed something a bit odd about my embedding layer. Let me explain the data:
I have 4 batches, each with a sequence length of 100, and a vocab size of 83. I am working with songs in ABC notation, so the song can have 83 different symbols in it and it is 100 symbols long.
So now I have an ndarray of shape (4, 100) which contains my 4 sequences of songs. Let's call it x.
Now if I pass x into an embedding layer in Keras:
tf.keras.layers.Embedding(83, 256, batch_input_shape=[4, None])(x).numpy()
I get a more "narrow" set of values for each batch than I do in PyTorch, does this affect my convergence?. I.E. the minimum value in the first batch is -0.04999 and the maximum value is 0.04999.
Now if I pass the same x into my PyTorch embedding layer:
torch.nn.Embedding(4*100, 256)(torch.tensor(x)).detach().numpy()
I get a "wider" set of values for each batch. The maximum value is 3.3865 and the minimum value is -3.917.
My question is, should I be worried that this is a cause for my model not converging properly?
