Skip to content

Commit

Permalink
Revise code
Browse files Browse the repository at this point in the history
  • Loading branch information
LLee233 committed Nov 28, 2023
1 parent 998c46a commit 8b55dd7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
8 changes: 4 additions & 4 deletions test/mkldnn/test_elementwise_add_onednn_op_rare_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
from test_elementwise_add_op import TestElementwiseAddOp

from paddle import enable_static
from paddle.base import core
from paddle.base.framework import _current_expected_place


@OpTestTool.skip_if(
not (isinstance(_current_expected_place(), core.CPUPlace)),
"GPU is not supported",
)
class TestOneDNNElementwiseAddOp(TestElementwiseAddOp):
# Special cases for swin transformer, will ignore grad check
class TestOneDNNlementwiseAddSrcDifferentShape(TestElementwiseAddOp):
def init_kernel_type(self):
self.use_mkldnn = True

Expand All @@ -41,9 +44,6 @@ def test_check_grad_ignore_y(self):
def test_check_grad_ignore_x(self):
pass


# Special cases for swin transformer, will ignore grad check
class TestOneDNNlementwiseAddSrcDifferentShape(TestOneDNNElementwiseAddOp):
def init_input_output(self):
self.x = np.random.random((1, 4, 16, 12, 12)).astype(self.dtype)
self.y = np.random.random((1, 4, 1, 12, 12)).astype(self.dtype)
Expand Down
11 changes: 0 additions & 11 deletions test/mkldnn/test_elementwise_sub_onednn_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,6 @@ def init_dtype(self):
def test_check_output(self):
self.check_output(check_pir=True)

def init_input_output(self):
self.x = np.random.uniform(0.1, 1, [13, 17]).astype(self.dtype)
self.y = np.random.uniform(0.1, 1, [13, 17]).astype(self.dtype)
self.out = np.subtract(self.x, self.y)

def init_dtype(self):
self.dtype = np.float32

def init_axis(self):
self.axis = -1

def if_check_prim(self):
self.check_prim = self.axis == -1

Expand Down

0 comments on commit 8b55dd7

Please sign in to comment.