コード例 #1
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_arguments():
    """
    args passing during initialization.
    """
    n = msd.LogNormal()
    assert isinstance(n, msd.Distribution)
    n = msd.LogNormal([3.0], [4.0], dtype=dtype.float32)
    assert isinstance(n, msd.Distribution)
コード例 #2
0
 def __init__(self, shape, seed=0):
     super(Sampling, self).__init__()
     self.ln = msd.LogNormal(np.array([0.3]),
                             np.array([[0.2], [0.4]]),
                             seed=seed,
                             dtype=dtype.float32)
     self.shape = shape
コード例 #3
0
 def __init__(self):
     super(KL, self).__init__()
     self.ln = msd.LogNormal(np.array([0.3]),
                             np.array([0.4]),
                             dtype=dtype.float32)
コード例 #4
0
 def __init__(self):
     super(LogProb, self).__init__()
     self.ln = msd.LogNormal(np.array([0.3]),
                             np.array([[0.2], [0.4]]),
                             dtype=dtype.float32)
コード例 #5
0
 def __init__(self):
     super(Net, self).__init__()
     self.LogNormal = msd.LogNormal(0., 1., dtype=dtype.float32)
コード例 #6
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogNormalProb1, self).__init__()
     self.lognormal = msd.LogNormal()
コード例 #7
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogNormalProb, self).__init__()
     self.lognormal = msd.LogNormal(3.0, 4.0, dtype=dtype.float32)
コード例 #8
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_sd():
    with pytest.raises(ValueError):
        msd.LogNormal(0., 0.)
    with pytest.raises(ValueError):
        msd.LogNormal(0., -1.)
コード例 #9
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_name():
    with pytest.raises(TypeError):
        msd.LogNormal(0., 1., name=1.0)
コード例 #10
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_seed():
    with pytest.raises(TypeError):
        msd.LogNormal(0., 1., seed='seed')
コード例 #11
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_type():
    with pytest.raises(TypeError):
        msd.LogNormal(0., 1., dtype=dtype.int32)
コード例 #12
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
def test_lognormal_shape_errpr():
    """
    Invalid shapes.
    """
    with pytest.raises(ValueError):
        msd.LogNormal([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32)
コード例 #13
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogNormalConstruct, self).__init__()
     self.lognormal = msd.LogNormal(3.0, 4.0)
     self.lognormal1 = msd.LogNormal()
コード例 #14
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogNormalBasics, self).__init__()
     self.n = msd.LogNormal(3.0, 4.0, dtype=dtype.float32)
コード例 #15
0
ファイル: test_lognormal.py プロジェクト: yrpang/mindspore
 def __init__(self):
     super(LogNormalCrossEntropy, self).__init__()
     self.n1 = msd.LogNormal(np.array([3.0]), np.array([4.0]), dtype=dtype.float32)
     self.n2 = msd.LogNormal(dtype=dtype.float32)