I want to create a learnable input matrix. So I create it as nn.Parameter. But I want to use a relu to make it non-negative and a softmax to make it normalized.
class Model(nn.Module):
    def __init__(self):
        super().__init__()
        self.weight = nn.Parameter(torch.randn(10, 10))
    
    def forward(self, x):
        self.weight = F.softmax(self.weight.relu(), dim=1)

The error is

cannot assign ‘torch.FloatTensor’ as parameter ‘weight’ (torch.nn.Parameter or None expected)

So what is the right way to do it?