Skip to content

Skip some test_nn tests which don't work on ROCm… #131

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion test/common_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import torch
import torch.cuda
from common import TEST_WITH_ROCM


TEST_CUDA = torch.cuda.is_available()
TEST_MULTIGPU = TEST_CUDA and torch.cuda.device_count() >= 2
CUDA_DEVICE = TEST_CUDA and torch.device("cuda:0")
TEST_CUDNN = TEST_CUDA and torch.backends.cudnn.is_acceptable(torch.tensor(1., device=CUDA_DEVICE))
TEST_CUDNN = TEST_CUDA and (TEST_WITH_ROCM or torch.backends.cudnn.is_acceptable(torch.tensor(1., device=CUDA_DEVICE)))
TEST_CUDNN_VERSION = TEST_CUDNN and torch.backends.cudnn.version()


Expand Down
7 changes: 5 additions & 2 deletions test/common_nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
import torch.cuda
from torch.nn.functional import _Reduction
from common import TestCase, to_gpu, freeze_rng_state, is_iterable
from common import TestCase, to_gpu, freeze_rng_state, is_iterable, TEST_WITH_ROCM
from common_cuda import TEST_CUDA
from torch.autograd.gradcheck import get_numerical_jacobian, iter_tensors
import torch.backends.cudnn
Expand Down Expand Up @@ -125,7 +125,8 @@ def get_weight(m):
module_name='ELU',
constructor_args=(2.,),
input_size=(3, 2, 5),
reference_fn=lambda x, _: torch.where(x >= 0, x, 2 * (x.exp() - 1))
reference_fn=lambda x, _: torch.where(x >= 0, x, 2 * (x.exp() - 1)),
test_cuda=(not TEST_WITH_ROCM),
),
# TODO: reference function
dict(
Expand Down Expand Up @@ -720,6 +721,7 @@ def ctcloss_reference(log_probs, targets, input_lengths, target_lengths, blank=0
reference_fn=lambda i, t, m:
cosineembeddingloss_reference(i[0], i[1], t, reduction=get_reduction(m)),
check_sum_reduction=True,
test_cuda=(not TEST_WITH_ROCM),
),
dict(
module_name='CosineEmbeddingLoss',
Expand All @@ -730,6 +732,7 @@ def ctcloss_reference(log_probs, targets, input_lengths, target_lengths, blank=0
cosineembeddingloss_reference(i[0], i[1], t, margin=0.7, reduction=get_reduction(m)),
desc='margin',
check_sum_reduction=True,
test_cuda=(not TEST_WITH_ROCM),
),
dict(
module_name='MarginRankingLoss',
Expand Down
Loading