You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement the 1D flow as shown in Flow Models Demos (Official).ipynb. I can't figure out what is self.loc in the MixtureCDFFlow class. Also, what does self.n_components denote?
This is the code
def flow(self, x):
# set up mixture distribution
weights = F.softmax(self.weight_logits, dim=0).unsqueeze(0).repeat(x.shape[0], 1)
mixture_dist = self.mixture_dist(self.loc, self.log_scale.exp())
x_repeat = x.unsqueeze(1).repeat(1, self.n_components)
# z = cdf of x
z = (mixture_dist.cdf(x_repeat) * weights).sum(dim=1)
# log_det = log dz/dx = log pdf(x)
log_det = (mixture_dist.log_prob(x_repeat).exp() * weights).sum(dim=1).log()
return z, log_det
Some help is really appreciated.
Thanks
The text was updated successfully, but these errors were encountered:
I am trying to implement the 1D flow as shown in
Flow Models Demos (Official).ipynb
. I can't figure out what isself.loc
in theMixtureCDFFlow
class. Also, what doesself.n_components
denote?This is the code
Some help is really appreciated.
Thanks
The text was updated successfully, but these errors were encountered: