Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speedup global test #8468

Merged
merged 5 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/oneflow/test/modules/test_consistent_adaptive_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class TestAdaptiveAvgPool(flow.unittest.TestCase):
def test_adaptive_avgpool(test_case):
for placement in all_placement():
ndim = 3
for sbp in all_sbp(placement, max_dim=ndim):
for sbp in all_sbp(placement, max_dim=2):
_test_adaptive_avgpoolnd(test_case, ndim, 1, placement, sbp)
_test_adaptive_avgpoolnd_functional(test_case, ndim, 1, placement, sbp)

ndim = 4
for sbp in all_sbp(placement, max_dim=ndim):
for sbp in all_sbp(placement, max_dim=2):
_test_adaptive_avgpoolnd(test_case, ndim, 2, placement, sbp)
_test_adaptive_avgpoolnd_functional(test_case, ndim, 2, placement, sbp)

Expand All @@ -81,7 +81,7 @@ def test_adaptive_avgpool(test_case):
):
continue
ndim = 5
for sbp in all_sbp(placement, max_dim=ndim):
for sbp in all_sbp(placement, max_dim=2):
_test_adaptive_avgpoolnd(test_case, ndim, 3, placement, sbp)
_test_adaptive_avgpoolnd_functional(test_case, ndim, 3, placement, sbp)

Expand Down
8 changes: 4 additions & 4 deletions python/oneflow/test/modules/test_consistent_rnn_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from oneflow.test_utils.automated_test_util import *


@autotest(n=2, check_graph=False)
@autotest(n=1, check_graph=False)
def _test_lstm_cell(test_case, placement, sbp):
batch_size = random(2, 3) * 8
time_steps = random(2, 3) * 8
Expand Down Expand Up @@ -68,7 +68,7 @@ def _test_lstm_cell(test_case, placement, sbp):
return res[0]


@autotest(n=2, check_graph=False)
@autotest(n=1, check_graph=False)
def _test_rnn_relu_cell(test_case, placement, sbp):
batch_size = random(2, 3) * 8
time_steps = random(2, 3) * 8
Expand Down Expand Up @@ -112,7 +112,7 @@ def _test_rnn_relu_cell(test_case, placement, sbp):
return hx


@autotest(n=2, check_graph=False)
@autotest(n=1, check_graph=False)
def _test_rnn_tanh_cell(test_case, placement, sbp):
batch_size = random(2, 3) * 8
time_steps = random(2, 3) * 8
Expand Down Expand Up @@ -156,7 +156,7 @@ def _test_rnn_tanh_cell(test_case, placement, sbp):
return hx


@autotest(n=2, check_graph=False)
@autotest(n=1, check_graph=False)
def _test_gru_cell(test_case, placement, sbp):
batch_size = random(2, 3) * 8
time_steps = random(2, 3) * 8
Expand Down
22 changes: 9 additions & 13 deletions python/oneflow/test/modules/test_consistent_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,24 @@
@autotest(n=1, check_graph=False)
def _test_flow_global_var_all_dim_with_random_data(test_case, placement, sbp):
x = random_tensor(
ndim=4,
ndim=2,
dim0=random(1, 3).to(int) * 8,
dim1=random(1, 3).to(int) * 8,
dim2=random(1, 3).to(int) * 8,
dim3=random(1, 3).to(int) * 8,
).to_global(placement, sbp)
y = torch.var(x)
return y


@autotest(n=2, check_graph=False)
@autotest(n=1, check_graph=False)
def _test_flow_global_var_one_dim_with_random_data(test_case, placement, sbp):
x = random_tensor(
ndim=4,
ndim=2,
dim0=random(1, 3).to(int) * 8,
dim1=random(1, 3).to(int) * 8,
dim2=random(1, 3).to(int) * 8,
dim3=random(1, 3).to(int) * 8,
).to_global(placement, sbp)
y = torch.var(
x,
dim=random(low=0, high=4).to(int),
dim=random(low=0, high=2).to(int),
unbiased=random().to(bool),
keepdim=random().to(bool),
)
Expand All @@ -55,10 +51,10 @@ def _test_flow_global_var_one_dim_with_random_data(test_case, placement, sbp):

@autotest(n=1, auto_backward=True, check_graph=False)
def _test_flow_var_0_size_data_with_random_data(test_case, placement, sbp):
x = random_tensor(4, 8, 16, 0, 8).to_global(placement, sbp)
x = random_tensor(3, 8, 0, 8).to_global(placement, sbp)
y = torch.var(
x,
dim=random(low=0, high=4).to(int),
dim=random(low=0, high=3).to(int),
unbiased=random().to(bool),
keepdim=random().to(bool),
)
Expand All @@ -69,23 +65,23 @@ class TestVar(flow.unittest.TestCase):
@globaltest
def test_flow_global_var_all_dim_with_random_data(test_case):
for placement in all_placement():
for sbp in all_sbp(placement, max_dim=4):
for sbp in all_sbp(placement, max_dim=2):
_test_flow_global_var_all_dim_with_random_data(
test_case, placement, sbp
)

@globaltest
def test_flow_global_var_one_dim_with_random_data(test_case):
for placement in all_placement():
for sbp in all_sbp(placement, max_dim=4):
for sbp in all_sbp(placement, max_dim=2):
_test_flow_global_var_one_dim_with_random_data(
test_case, placement, sbp
)

@globaltest
def test_flow_var_0_size_data_with_random_data(test_case):
for placement in all_placement():
for sbp in all_sbp(placement, max_dim=4, valid_split_axis=[0, 1, 3]):
for sbp in all_sbp(placement, max_dim=2, valid_split_axis=[0]):
_test_flow_var_0_size_data_with_random_data(test_case, placement, sbp)


Expand Down