Beispiel #1
0
def test_insert_compose():
    comp = transforms.Compose([transforms.GaussianNoise()])
    comp.insert(0, transforms.FixedWindow(100))
    assert isinstance(comp.transforms[0], transforms.FixedWindow)

    comp = transforms.Compose([transforms.GaussianNoise()])
    comp.insert(1, transforms.FixedWindow(100))
    assert isinstance(comp.transforms[1], transforms.FixedWindow)
Beispiel #2
0
def test_fixedwindow():
    size = 128
    is_pass = False

    try:
        _ = transforms.FixedWindow(size, -1)
    except ValueError:
        is_pass = True

    assert is_pass
Beispiel #3
0
def test_fixedwindow_np_3():
    size = 128
    fw = transforms.FixedWindow(size, 1000)
    is_pass = False

    try:
        _ = fw(np_x)
    except IndexError:
        is_pass = True

    assert is_pass
Beispiel #4
0
def test_fixedwindow_torch_2():
    size = 1000
    fw = transforms.FixedWindow(size)
    is_pass = False

    try:
        _ = fw(torch_x)
    except IndexError:
        is_pass = True

    assert is_pass
Beispiel #5
0
def test_fixedwindow_np_1():
    size = 128
    fw = transforms.FixedWindow(size)
    out = fw(np_x)
    assert out.shape[0] == size
    assert out.shape[1] == features
Beispiel #6
0
def test_extend_compose():
    comp = transforms.Compose([transforms.GaussianNoise()])
    comp.extend([transforms.FixedWindow(100), transforms.RandomScaling()])
    assert isinstance(comp.transforms[0], transforms.GaussianNoise)
    assert isinstance(comp.transforms[1], transforms.FixedWindow)
    assert isinstance(comp.transforms[2], transforms.RandomScaling)
Beispiel #7
0
def test_append_compose():
    comp = transforms.Compose([transforms.GaussianNoise()])
    comp.append(transforms.FixedWindow(100))
    assert isinstance(comp.transforms[-1], transforms.FixedWindow)