Parent nodes with missing data

Looks like the above fix of replacing to-be-masked nan values now must also be used for non-Categorical distributions. As far as I can tell it’s because while calculating logprob the sampler will first check the validity of all observations, regardless of any poutine masking…

MWE
import pyro
import pyro.distributions as dist
from pyro.infer import Trace_ELBO
import torch

obs = torch.tensor((0, 0, float('nan')))  # <--- yields error (shown below)
obs = torch.tensor((0, 0, 20))            # <--- no error; 20 will be ignored in loss calculation because of mask
mask = torch.tensor((True, True, False)

def model():
    with pyro.plate('plate', size=len(obs)):
        with pyro.poutine.mask(mask=mask):
            return pyro.sample('node', dist.Normal(0, 1), obs=obs)


def guide():
    pass


print(Trace_ELBO().loss(model, guide)). <--- prints 1.83
Error trace
ValueError: Error while computing log_prob at site 'node':
The value argument must be within the support
Trace Shapes:    
 Param Sites:    
Sample Sites:    
    node dist 3 |
        value 3 |