The output of your current script is expected, since each call into dropout_layer will sample a new random mask.
The initial seed makes sure that sequential calls into the random number generator will yield the same “random” numbers, but of course it’s not forcing dropout layers to sample a constant mask.
If you want to force the dropout layers to behave exactly the same, you could either seed the code right before the call (which would get rid of the randomness and thus I would assume your model to perform badly) via:
x_batch_first = torch.ones(2,3,4)
x_batch_second = torch.ones(3,2,4)

dropout_layer = nn.Dropout(p=0.5)

torch.manual_seed(2809)
output1 = dropout_layer(x_batch_first)
torch.manual_seed(2809)
output2 = dropout_layer(x_batch_second.transpose(0, 1))
torch.equal(output1, output2)
> True

or maybe sample the dropout masks manually outside of the training script and just apply them.
Note that even seeding the layer would give different results, if the tensors have different shapes, which is why I’ve transposed the second input before the dropout call.