Exemple #1
0
def clip_mvnormal_proposal(old_point):
    # batches of old points, possibly with weird shapes
    samp = MultivariateNormal(old_point,
                              0.3 * torch.eye(old_point.shape[-1])).sample()
    samp.clamp_min_(0.0)
    samp.clamp_max_(1.0)
    return samp
Exemple #2
0
 def forward(self, x):
     samp = MultivariateNormal(x, self.sigma *
                               torch.eye(x.shape[-1])).sample()
     samp.clamp_min_(self.min_val)
     samp.clamp_max_(self.max_val)
     return samp