assert all(tensors[0].size(0) == tensor.size(0) for tensor in tensors)

Capture1

Your issue is similar to this one.

Basically, the passed tensors have a different length, which raises this error.

Let me know, if you need more information.