No, but I have a suggestion without requiring grad on a leaf variable :
n = 5
mat = torch.zeros(5, 5)
vector = torch.randn(10, requires_grad=True)
mat[numpy.triu_indices(n, 1)] = vector
mat.sum().backward()
vector.grad

gives the expected vector of 10 ones. So mat doesn’t require_grad when it is instantiated, but only indirectly when you assign elements requiring grad to it.
That works.
Best regards
Thomas