How to get trapezoidal matrix?

how do you get upper/lower trapezoidal part of the matrix? i see functions like triu and tril but nothing related to trapazoid.

torch.tril() and torch.triu() support non-square matrices.

If you want to have the diagonal entries set to zero, you could subtract torch.diag() from either torch.tril() or torch.triu()