コード例 #1
0
def test_arguments():
    """
    args passing during initialization.
    """
    g = msd.Gamma()
    assert isinstance(g, msd.Distribution)
    g = msd.Gamma([3.0], [4.0], dtype=dtype.float32)
    assert isinstance(g, msd.Distribution)
コード例 #2
0
ファイル: test_gamma.py プロジェクト: yrpang/mindspore
 def __init__(self, shape, seed=0):
     super(Sampling, self).__init__()
     self.g = msd.Gamma(np.array([3.0]),
                        np.array([1.0]),
                        seed=seed,
                        dtype=dtype.float32)
     self.shape = shape
コード例 #3
0
 def __init__(self,
              concentration,
              rate,
              seed=10,
              dtype=ms.float32,
              name='Gamma'):
     super().__init__()
     self.b = msd.Gamma(concentration, rate, seed, dtype, name)
コード例 #4
0
def test_gamma_shape_errpr():
    """
    Invalid shapes.
    """
    with pytest.raises(ValueError):
        msd.Gamma([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32)
コード例 #5
0
def test_type():
    with pytest.raises(TypeError):
        msd.Gamma(0., 1., dtype=dtype.int32)
コード例 #6
0
 def __init__(self):
     super(GammaBasics, self).__init__()
     self.g = msd.Gamma(np.array([3.0, 4.0]),
                        np.array([4.0, 6.0]),
                        dtype=dtype.float32)
コード例 #7
0
 def __init__(self):
     super(GammaConstruct, self).__init__()
     self.gamma = msd.Gamma([3.0], [4.0])
     self.gamma1 = msd.Gamma()
コード例 #8
0
 def __init__(self):
     super(GammaProb, self).__init__()
     self.gamma = msd.Gamma([3.0, 4.0], [1.0, 1.0], dtype=dtype.float32)
コード例 #9
0
def test_rate():
    with pytest.raises(ValueError):
        msd.Gamma([0.], [0.])
    with pytest.raises(ValueError):
        msd.Gamma([0.], [-1.])
コード例 #10
0
def test_concentration1():
    with pytest.raises(ValueError):
        msd.Gamma(0., 1.)
    with pytest.raises(ValueError):
        msd.Gamma(-1., 1.)
コード例 #11
0
def test_rate():
    with pytest.raises(ValueError):
        msd.Gamma(0., 0.)
    with pytest.raises(ValueError):
        msd.Gamma(0., -1.)
コード例 #12
0
ファイル: test_beta.py プロジェクト: yrpang/mindspore
def test_concentration0():
    with pytest.raises(ValueError):
        msd.Gamma([1.], [0.])
    with pytest.raises(ValueError):
        msd.Gamma([1.], [-1.])
コード例 #13
0
ファイル: test_beta.py プロジェクト: yrpang/mindspore
def test_scalar():
    with pytest.raises(TypeError):
        msd.Gamma(3., [4.])
    with pytest.raises(TypeError):
        msd.Gamma([3.], -4.)
コード例 #14
0
ファイル: test_beta.py プロジェクト: yrpang/mindspore
def test_seed():
    with pytest.raises(TypeError):
        msd.Gamma([0.], [1.], seed='seed')
コード例 #15
0
ファイル: test_beta.py プロジェクト: yrpang/mindspore
def test_name():
    with pytest.raises(TypeError):
        msd.Gamma([0.], [1.], name=1.0)
コード例 #16
0
ファイル: test_beta.py プロジェクト: yrpang/mindspore
def test_type():
    with pytest.raises(TypeError):
        msd.Gamma([0.], [1.], dtype=dtype.int32)
コード例 #17
0
def test_name():
    with pytest.raises(TypeError):
        msd.Gamma(0., 1., name=1.0)
コード例 #18
0
def test_concentration0():
    with pytest.raises(ValueError):
        msd.Gamma(1., 0.)
    with pytest.raises(ValueError):
        msd.Gamma(1., -1.)
コード例 #19
0
def test_seed():
    with pytest.raises(TypeError):
        msd.Gamma(0., 1., seed='seed')
コード例 #20
0
ファイル: test_gamma.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(CrossEntropy, self).__init__()
     self.g = msd.Gamma(np.array([3.0]),
                        np.array([1.0]),
                        dtype=dtype.float32)
コード例 #21
0
ファイル: test_gamma.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(Net, self).__init__()
     self.get_flags = msd.Gamma(np.array([3.0]),
                                np.array([1.0]),
                                dtype=dtype.float32)
コード例 #22
0
 def __init__(self):
     super(GammaCrossEntropy, self).__init__()
     self.g1 = msd.Gamma(np.array([3.0]),
                         np.array([4.0]),
                         dtype=dtype.float32)
     self.g2 = msd.Gamma(dtype=dtype.float32)
コード例 #23
0
 def __init__(self):
     super(GammaProb1, self).__init__()
     self.gamma = msd.Gamma()
コード例 #24
0
ファイル: test_gamma.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogProb, self).__init__()
     self.g = msd.Gamma(np.array([3.0]),
                        np.array([1.0]),
                        dtype=dtype.float32)