Skip to content

Commit

Permalink
[Enhancement] Reduce the randomness in unit test of `stylegan3_utils.…
Browse files Browse the repository at this point in the history
…py` (#1306)

make s3-utils unit test more robustic
LeoXing1996 authored Oct 17, 2022
1 parent 5a38f5b commit f33a09d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -16,6 +16,13 @@ def test_integer_transformation():
print(z.shape)
print(m.shape)

# cover more lines
t = torch.zeros(2)
z, m = apply_integer_translation(x, t[0], t[1])

t = torch.ones(2) * 2
z, m = apply_integer_translation(x, t[0], t[1])


def test_fractional_translation():
x = torch.randn(1, 3, 16, 16)
@@ -24,6 +31,13 @@ def test_fractional_translation():
print(z.shape)
print(m.shape)

# cover more lines
t = torch.zeros(2)
z, m = apply_fractional_translation(x, t[0], t[1])

t = torch.ones(2) * 2
z, m = apply_fractional_translation(x, t[0], t[1])


@pytest.mark.skipif(
digit_version(TORCH_VERSION) < digit_version('1.8.0'),

0 comments on commit f33a09d

Please sign in to comment.