Well, based on the link you’ve posted, you could use the functional API and change the weight tensor manually.
However, if you increase the size of your weight, what new values should be there?
Should it be initialized randomly, while the rest of the weight tensor was already learned?
If so, here is a small example:
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.weight = nn.Parameter(torch.randn(10, 2))
        
    def forward(self, x):
        x = F.linear(x, self.weight)
        return x

model = MyModel()
x = torch.randn(1, 2)
output = model(x)
output.mean().backward()
print(model.weight.grad)
model.zero_grad()

# Add another input feature
with torch.no_grad():
    model.weight = nn.Parameter(torch.cat((model.weight, torch.randn(10, 1)), 1))

x = torch.randn(1, 3)
output = model(x)
output.mean().backward()
print(model.weight.grad)
model.zero_grad()