[test] refactor tests with spawn (#3452)

* [test] added spawn decorator

* polish code

* polish code

* polish code

* polish code

* polish code

* polish code
This commit is contained in:
Frank Lee
2023-04-06 14:51:35 +08:00
committed by GitHub
parent 62f4e2eb07
commit 80eba05b0a
240 changed files with 1723 additions and 2342 deletions

View File

@@ -1,7 +1,10 @@
import torch
from colossalai.fx.tracer.meta_patch import patched_function
from functools import partial
import torch
from colossalai.fx.tracer.meta_patch import patched_function
from colossalai.testing import clear_cache_before_run
def _run(data, patch_fn):
try:
@@ -22,6 +25,7 @@ def _assert_output_shape(data, patch_fn, expect_exception, output_shape):
assert output.shape == output_shape
@clear_cache_before_run()
def test_repeat_interleave():
patch_fn = patched_function.torch_repeat_interleave
@@ -63,6 +67,7 @@ def test_repeat_interleave():
output_shape=materialized_output.shape)
@clear_cache_before_run()
def test_torch_max():
data = torch.rand(4, 3)
out = torch.max(data)