-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cacceb6
commit 7919910
Showing
2 changed files
with
22 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import torch | ||
import pytest | ||
|
||
from yann.data.place import Place | ||
|
||
|
||
def test_place(): | ||
devices = ['cpu', 'cuda'] if torch.cuda.is_available() else ['cpu'] | ||
|
||
|
||
@pytest.mark.parametrize('device', devices) | ||
def test_place(device): | ||
import torch | ||
tuple_batch = (torch.rand(3,3), torch.rand(3,1), 'foo') | ||
|
||
place = Place(('cpu', 'cuda')) | ||
place = Place(('cpu', device)) | ||
b = place(tuple_batch) | ||
# assert b[0].device == 'cpu' | ||
assert b[2] == 'foo' |