예제 #1
0
def test_prob():
    """
    Invalid probability.
    """
    with pytest.raises(ValueError):
        msd.Geometric([-0.1], dtype=dtype.int32)
    with pytest.raises(ValueError):
        msd.Geometric([1.1], dtype=dtype.int32)
예제 #2
0
def test_arguments():
    """
    Args passing during initialization.
    """
    g = msd.Geometric()
    assert isinstance(g, msd.Distribution)
    g = msd.Geometric([0.0, 0.3, 0.5, 1.0], dtype=dtype.int32)
    assert isinstance(g, msd.Distribution)
예제 #3
0
 def __init__(self):
     super(KL, self).__init__()
     self.g = msd.Geometric(0.7, dtype=dtype.int32)
예제 #4
0
 def __init__(self):
     super(CrossEntropy, self).__init__()
     self.g = msd.Geometric(0.7, dtype=dtype.int32)
예제 #5
0
 def __init__(self, shape, seed=0):
     super(Sampling, self).__init__()
     self.g = msd.Geometric([0.7, 0.5], seed=seed, dtype=dtype.int32)
     self.shape = shape
예제 #6
0
 def __init__(self):
     super(Basics, self).__init__()
     self.g = msd.Geometric([0.5, 0.5], dtype=dtype.int32)
예제 #7
0
 def __init__(self):
     super(GeometricProb1, self).__init__()
     self.g = msd.Geometric(dtype=dtype.int32)
예제 #8
0
 def __init__(self):
     super(GeoConstruct, self).__init__()
     self.g = msd.Geometric(0.5, dtype=dtype.int32)
     self.g1 = msd.Geometric(dtype=dtype.int32)
예제 #9
0
 def __init__(self):
     super(GeometricCrossEntropy, self).__init__()
     self.g1 = msd.Geometric(0.3, dtype=dtype.int32)
     self.g2 = msd.Geometric(dtype=dtype.int32)
예제 #10
0
 def __init__(self):
     super(GeometricKl, self).__init__()
     self.g1 = msd.Geometric(0.7, dtype=dtype.int32)
     self.g2 = msd.Geometric(dtype=dtype.int32)
예제 #11
0
def test_seed():
    with pytest.raises(TypeError):
        msd.Geometric([0.1], seed='seed')
예제 #12
0
def test_name():
    with pytest.raises(TypeError):
        msd.Geometric([0.1], name=1.0)
예제 #13
0
def test_type():
    with pytest.raises(TypeError):
        msd.Geometric([0.1], dtype=dtype.float32)