Can you post a minimal reproducible example?  Because it’s hard to visualize what your error is without the broader context.
If it’s purely the original error, it’s because your Tensors are of different sizes and torch.stack won’t work, and you might need to use torch.cat instead.