acids-ircam / pytorch_flows

Implementation and tutorials of normalizing flows with the novel distributions module
GNU General Public License v3.0
160 stars 17 forks source link

Bug issue when running flows_01.ipynb #8

Open JoseAntonioSiguenza opened 2 years ago

JoseAntonioSiguenza commented 2 years ago

Hi!! Thanks for sharing this normalizing flow model with pytorch, it is really exciting.

When running the fifth cell of code a Value Error appears concerning the q1 distribution. It seems rare because the empirical values don't throw any problem. It may be a deprecated version of pytorch used back then. The following message appears:

ValueError Traceback (most recent call last)

in () 1 q0_density = torch.exp(q0.log_prob(torch.Tensor(x))).numpy() ----> 2 q1_density = torch.exp(q1.log_prob(torch.Tensor(x))).numpy() 3 fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, figsize=(15, 5)) 4 ax1.plot(x, q0_density); ax1.fill_between(x, q0_density, 0, alpha=0.5) 5 ax1.set_title('$q_0 = \mathcal{N}(0,1)$', fontsize=18); 1 frames /usr/local/lib/python3.7/dist-packages/torch/distributions/distribution.py in _validate_sample(self, value) 287 if not valid.all(): 288 raise ValueError( --> 289 "Expected value argument " 290 f"({type(value).__name__} of shape {tuple(value.shape)}) " 291 f"to be within the support ({repr(support)}) " ValueError: Expected value argument (Tensor of shape (1000,)) to be within the support (GreaterThan(lower_bound=0.0)) of the distribution TransformedDistribution(), but found invalid values. The expected behaviour would be a density distribution for q1.