Hi,
I’m using Pytorch 1.7.1 on CPU and I’m getting inconsistent results during inference over the same data.
It seems that the GRU implementation gives slightly different results for a sample by sample prediction vs batched prediction.
Here is a code to reproduce the problem:

import torch
a = torch.randn((128, 500, 4))
layer = torch.nn.GRU(4, 4, num_layers=2, dropout=0.0, bidirectional=True, batch_first=True)
layer.eval()
batched, _ = layer(a)
obo = torch.zeros(batched.shape)
for i in range(128):
 obo[i] = layer(a[[i]])[0][0]
batched == obo

I was expecting this code to return only True but instead returns a mix of True and False. Is it normal or is it a pytorch problem ?
Thank you for your time