Does random seed in pytorch has the effect on the function of drop out?

Yes, dropout layers will also be affected by the random seed, as they are sampling from the PRNG:

x = torch.randn(1, 10)

torch.manual_seed(2809)
d11 = F.dropout(x, p=0.5, training=True)
d12 = F.dropout(x, p=0.5, training=True)

torch.manual_seed(2809)
d21 = F.dropout(x, p=0.5, training=True)
d22 = F.dropout(x, p=0.5, training=True)

print((d11==d21).all())
print((d12==d22).all())
3 Likes