Пример #1
0
 def __init__(self, shape, seed=0):
     super(Net4, self).__init__()
     self.n = nn.Normal(np.array([3.0]),
                        np.array([[2.0], [4.0]]),
                        seed=seed,
                        dtype=dtype.float32)
     self.shape = shape
Пример #2
0
def test_no_arguments():
    """
    No args passed in during initialization.
    """
    n = nn.Normal()
    assert isinstance(n, nn.Distribution)
    b = nn.Bernoulli()
    assert isinstance(b, nn.Distribution)
Пример #3
0
def test_with_arguments():
    """
    Args passed in during initialization.
    """
    n = nn.Normal([3.0], [4.0], dtype=dtype.float32)
    assert isinstance(n, nn.Distribution)
    b = nn.Bernoulli([0.3, 0.5], dtype=dtype.int32)
    assert isinstance(b, nn.Distribution)
Пример #4
0
 def __init__(self):
     super(Net3, self).__init__()
     self.n = nn.Normal(np.array([3.0]),
                        np.array([2.0, 4.0]),
                        dtype=dtype.float32)
Пример #5
0
 def __init__(self):
     super(NormalProb1, self).__init__()
     self.normal = nn.Normal()
Пример #6
0
 def __init__(self):
     super(NormalProb, self).__init__()
     self.normal = nn.Normal(3.0, 4.0, dtype=dtype.float32)
Пример #7
0
 def __init__(self):
     super(NormalBernoulli, self).__init__()
     self.n = nn.Normal(3.0, 4.0, dtype=dtype.float32)
     self.b = nn.Bernoulli(0.5, dtype=dtype.int32)
Пример #8
0
 def __init__(self):
     super(NormalKlNoArgs, self).__init__()
     self.n = nn.Normal(dtype=dtype.float32)
Пример #9
0
def test_normal_shape_errpr():
    """
    Invalid shapes.
    """
    with pytest.raises(ValueError):
        nn.Normal([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32)
Пример #10
0
 def __init__(self):
     super(NormalKl, self).__init__()
     self.n = nn.Normal(Tensor([3.0]), Tensor([4.0]), dtype=dtype.float32)
Пример #11
0
 def __init__(self):
     super(Net, self).__init__()
     self.normal = nn.Normal(0., 1., dtype=dtype.float32)