I am trying ot learn a MultivariateNormal distribution from a fixed set of samples.
Basically, I am trying to maximize the log_prob over some fixed samples. The simple version of the code will be like this:
class ParametricMultivariateNormal(nn.Module):
def __init__(self, s):
super().__init__()
self.dist = MultivariateNormal(loc=torch.zeros(s, requires_grad=True),
covariance_matrix=torch.eye(s, requires_grad=True))
def forward(self, value):
return self.dist.log_prob(value)
However, when I backward the -model(value)
, the distribution is not updated. What am I doing wrong?