Example #1
0
def test_uniform_range_as_range():
    from nntools.init import Uniform

    sample = Uniform((0.0, 1.0)).sample((300, 400))
    assert sample.shape == (300, 400)
    assert -0.1 < sample.min() < 0.1
    assert 0.9 < sample.max() < 1.1
Example #2
0
def test_uniform_range_as_number():
    from nntools.init import Uniform

    sample = Uniform(1.0).sample((300, 400))
    assert sample.shape == (300, 400)
    assert -1.1 < sample.min() < -0.9
    assert 0.9 < sample.max() < 1.1
Example #3
0
def test_uniform_glorot_receptive_field():
    from nntools.init import Uniform

    sample = Uniform().sample((150, 150, 2))
    assert -0.11 < sample.min() < -0.09
    assert 0.09 < sample.max() < 0.11
Example #4
0
def test_uniform_glorot():
    from nntools.init import Uniform

    sample = Uniform().sample((150, 450))
    assert -0.11 < sample.min() < -0.09
    assert 0.09 < sample.max() < 0.11