ColossalAI/tests/test_booster/test_accelerator.py
digger-yu 1f73609adb
[CI] fix typo with tests/ etc. (#3727)
* fix spelling error with examples/comminity/

* fix spelling error with tests/

* fix some spelling error with tests/ colossalai/ etc.

* fix spelling error with tests/ etc. date:2023.5.10
2023-05-11 16:30:58 +08:00

15 lines
443 B
Python

import torch.nn as nn
from colossalai.booster.accelerator import Accelerator
from colossalai.testing import clear_cache_before_run, parameterize
@clear_cache_before_run()
@parameterize('device', ['cpu', 'cuda'])
def test_accelerator(device):
accelerator = Accelerator(device)
model = nn.Linear(8, 8)
model = accelerator.configure_model(model)
assert next(model.parameters()).device.type == device
del model, accelerator