Exemplo n.º 1
0
def test_arguments():
    """
    args passing during initialization.
    """
    l = msd.Cauchy()
    assert isinstance(l, msd.Distribution)
    l = msd.Cauchy([3.0], [4.0], dtype=dtype.float32)
    assert isinstance(l, msd.Distribution)
Exemplo n.º 2
0
 def __init__(self, shape, seed=0):
     super(Sampling, self).__init__()
     self.c = msd.Cauchy(np.array([3.0]),
                         np.array([[2.0], [4.0]]),
                         seed=seed,
                         dtype=dtype.float32)
     self.shape = shape
Exemplo n.º 3
0
 def __init__(self):
     super(KL, self).__init__()
     self.c = msd.Cauchy(np.array([3.]),
                         np.array([4.]),
                         dtype=dtype.float32)
Exemplo n.º 4
0
 def __init__(self):
     super(LogProb, self).__init__()
     self.c = msd.Cauchy(np.array([3.0]),
                         np.array([[2.0], [4.0]]),
                         dtype=dtype.float32)
Exemplo n.º 5
0
 def __init__(self):
     super(CrossEntropy, self).__init__()
     self.c = msd.Cauchy(np.array([3.]),
                         np.array([[2.0], [4.0]]),
                         dtype=dtype.float32)
Exemplo n.º 6
0
 def __init__(self):
     super(Basics, self).__init__()
     self.c = msd.Cauchy(np.array([3.0]),
                         np.array([2.0, 4.0]),
                         dtype=dtype.float32)
Exemplo n.º 7
0
 def __init__(self):
     super(CauchyProb1, self).__init__()
     self.cauchy = msd.Cauchy()
Exemplo n.º 8
0
 def __init__(self):
     super(CauchyProb, self).__init__()
     self.cauchy = msd.Cauchy(3.0, 4.0, dtype=dtype.float32)
Exemplo n.º 9
0
def test_scale():
    with pytest.raises(ValueError):
        msd.Cauchy(0., 0.)
    with pytest.raises(ValueError):
        msd.Cauchy(0., -1.)
Exemplo n.º 10
0
def test_name():
    with pytest.raises(TypeError):
        msd.Cauchy(0., 1., name=1.0)
Exemplo n.º 11
0
def test_seed():
    with pytest.raises(TypeError):
        msd.Cauchy(0., 1., seed='seed')
Exemplo n.º 12
0
def test_type():
    with pytest.raises(TypeError):
        msd.Cauchy(0., 1., dtype=dtype.int32)
Exemplo n.º 13
0
def test_cauchy_shape_errpr():
    """
    Invalid shapes.
    """
    with pytest.raises(ValueError):
        msd.Cauchy([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32)
Exemplo n.º 14
0
 def __init__(self):
     super(CauchyConstruct, self).__init__()
     self.cauchy = msd.Cauchy(3.0, 4.0)
     self.cauchy1 = msd.Cauchy()
Exemplo n.º 15
0
 def __init__(self):
     super(KL, self).__init__()
     self.cauchy = msd.Cauchy(3.0, 4.0)
     self.cauchy1 = msd.Cauchy()
Exemplo n.º 16
0
 def __init__(self, loc, scale, seed=10, dtype=ms.float32, name='Cauchy'):
     super().__init__()
     self.b = msd.Cauchy(loc, scale, seed, dtype, name)