Beside numpy, PyTorch has now implemented tril_indices.
x = torch.tensor([1., 2., 3., 4., 5., 6.])
m = torch.zeros((3, 3))

tril_indices = torch.tril_indices(row=3, col=3, offset=0)
m[tril_indices[0], tril_indices[1]] = x