Пример #1
0
 def test_distribution_variant(self):
     """Confirms that the free functions that operate on a variant are
     bound."""
     items = [
         mut.Deterministic(1.0),
         mut.Gaussian(1.0, 0.1),
         mut.Uniform(-1.0, 1.0),
         mut.UniformDiscrete([0.0, 1.0]),
     ]
     for item in items:
         copied = mut.ToDistribution(item)
         self._check_distribution(copied)
         mut.Sample(var=item, generator=RandomGenerator())
         mut.Mean(var=item)
         mut.ToSymbolic(var=item)
         if mut.IsDeterministic(var=item):
             mut.GetDeterministicValue(var=item)
Пример #2
0
 def test_deterministic(self):
     mut.Deterministic()
     dut = mut.Deterministic(1.0)
     dut.value = 2.0
     self._check_distribution(dut)