How to create banded matrices from multiple bands

so I have multiple tensors containing bands (each different width). I now want to construct the full matrix from those bands. I have the “offset” of each band but I am unsure how to do it. I know torch.diag — PyTorch 1.11.0 documentation, but it assumes width = 1. Am I overlooking something?