示例#1
0
 def sample_functor(sample, *args):
     n = ek.slices(sample)
     plugin = instantiate(args)
     mi, ctx = make_context(n)
     wo, pdf = plugin.sample(ctx, mi, [sample[0], sample[1]])
     w = Float.full(1.0, ek.slices(pdf))
     w[ek.eq(pdf, 0)] = 0
     return wo, w
示例#2
0
    def sample_functor(sample, *args):
        n = ek.slices(sample)
        plugin = instantiate(args)
        (si, ctx) = make_context(n)
        bs, weight = plugin.sample(ctx, si, sample[0], [sample[1], sample[2]])

        w = Float.full(1.0, ek.slices(weight))
        w[ek.all(ek.eq(weight, 0))] = 0
        return bs.wo, w