Skip to content
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
11 changes: 5 additions & 6 deletions test/legacy_test/test_rnn_decode_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import unittest

import numpy as np
from op_test import is_custom_device
from op_test import get_device_place, is_custom_device

import paddle
from paddle import Model, base, nn, set_device
Expand Down Expand Up @@ -337,11 +337,10 @@ def check_output_with_place(self, place, mode="test"):
)

def check_output(self):
devices = (
["CPU", "GPU"]
if (base.is_compiled_with_cuda() or is_custom_device())
else ["CPU"]
)
devices = ["CPU"]
if base.is_compiled_with_cuda() or is_custom_device():
devices.append(get_device_place())

for device in devices:
place = set_device(device)
self.check_output_with_place(place)
Expand Down
8 changes: 4 additions & 4 deletions test/legacy_test/test_set_value_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1801,15 +1801,15 @@ def test_value_input_is_scalar(self):
)
class TestSetValueWithStrideError(unittest.TestCase):
def test_same_place(self):
x = paddle.rand([5, 10], device=paddle.CUDAPlace(0))
y = paddle.rand([10, 5], device=paddle.CUDAPlace(0))
x = paddle.rand([5, 10], device=get_device_place())
y = paddle.rand([10, 5], device=get_device_place())
y.transpose_([1, 0])
x.set_value(y)
assert x.is_contiguous()

def test_different_place1(self):
# src place != dst place && src is not contiguous
x = paddle.rand([5, 10], device=paddle.CUDAPlace(0))
x = paddle.rand([5, 10], device=get_device_place())
y = paddle.rand([10, 5], device=paddle.CPUPlace())
y.transpose_([1, 0])
x.set_value(y)
Expand All @@ -1818,7 +1818,7 @@ def test_different_place1(self):
def test_different_place2(self):
# src place != dst place && dst is not contiguous
with self.assertRaises(SystemError):
x = paddle.ones([5, 4], device=paddle.CUDAPlace(0))
x = paddle.ones([5, 4], device=get_device_place())
x.transpose_([1, 0])
y = paddle.rand([4, 2], device=paddle.CPUPlace())
assert not x.is_contiguous()
Expand Down
Loading