def test_distribution_vector_variant(self): """Confirms that the free functions that operate on a vector variant are bound.""" items = [ mut.DeterministicVectorX(value=[1.0]), mut.GaussianVectorX(mean=[1.0], stddev=[0.1]), mut.UniformVectorX(min=[-1.0], max=[1.0]), ] for item in items: copied = mut.ToDistributionVector(item) self._check_distribution_vector(copied) if mut.IsDeterministic(vec=item): mut.GetDeterministicValue(vec=item)
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)