Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions test/cinn/passes/test_transpose_floding_output_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def trans_out_func(self, builder, out):
return builder.transpose(out_s, [0, 2, 1])


class TestTransposeFoldingOutputPassInvlidTrans(TestTransposeFoldingOutputPass):
class TestTransposeFoldingOutputPassInvalidTrans(
TestTransposeFoldingOutputPass
):
def expect_folding_number(self):
return 1

Expand All @@ -88,7 +90,9 @@ def trans_out_func(self, builder, out):
return builder.scale(out_t, scale=2.0)


class TestTransposeFoldingOutputPassInvlidScale(TestTransposeFoldingOutputPass):
class TestTransposeFoldingOutputPassInvalidScale(
TestTransposeFoldingOutputPass
):
def expect_folding_number(self):
return 1

Expand Down
2 changes: 1 addition & 1 deletion test/dygraph_to_static/test_pylayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def _run_and_compare(self, *args, **kwargs):
dygraph_inp_kwargs[k].stop_gradient = False
static_inp_kwargs[k].stop_gradient = False

# Step2. Run the dygraph and the static seperately
# Step2. Run the dygraph and the static separately
dygraph_res = self._run_dygraph(*dygraph_inp_args, **dygraph_inp_kwargs)
static_res = self._run_static(*static_inp_args, **static_inp_kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class TestReshapeTransposeMatmulV2OneDNNFusePass(InferencePassTest):
def setUp(self):
self.set_params()
self.tranpose_perm = [0, 2, 1, 3]
self.transpose_perm = [0, 2, 1, 3]
self.pass_name = 'reshape_transpose_matmul_mkldnn_fuse_pass'

with base.program_guard(self.main_program, self.startup_program):
Expand All @@ -37,7 +37,7 @@ def setUp(self):
)

reshape = paddle.reshape(data, shape=self.reshape_shape)
transpose = paddle.transpose(reshape, self.tranpose_perm)
transpose = paddle.transpose(reshape, self.transpose_perm)

matmul = paddle.matmul(
transpose,
Expand Down
6 changes: 3 additions & 3 deletions test/ir/inference/test_trt_multiclass_nms3_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def multiclass_nms(
In the NMS step, this operator greedily selects a subset of detection bounding
boxes that have high scores larger than score_threshold, if providing this
threshold, then selects the largest nms_top_k confidences scores if nms_top_k
is larger than -1. Then this operator pruns away boxes that have high IOU
is larger than -1. Then this operator prunes away boxes that have high IOU
(intersection over union) overlap with already selected boxes by adaptive
threshold NMS based on parameters of nms_threshold and nms_eta.
Aftern NMS step, at most keep_top_k number of total bboxes are to be kept
After NMS step, at most keep_top_k number of total bboxes are to be kept
per image if keep_top_k is larger than -1.
Args:
bboxes (Tensor): Two types of bboxes are supported:
Expand Down Expand Up @@ -332,7 +332,7 @@ def test_background(self):
self.run_test()

def test_disable_varseqlen(self):
self.diable_tensorrt_varseqlen = False
self.disable_tensorrt_varseqlen = False
self.run_test()


Expand Down
14 changes: 7 additions & 7 deletions test/legacy_test/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ def forward(self, x):
return y, 0


class ModelOutter(paddle.nn.Layer):
class ModelOuter(paddle.nn.Layer):
def __init__(self):
super().__init__()
self.module1 = ModelInner()
self.module2 = paddle.nn.Linear(4, 5)

def forward(self, x):
y, dummpy = self.module1(x)
y, dumpy = self.module1(x)
y = self.module2(y)
return y, 3

Expand Down Expand Up @@ -704,7 +704,7 @@ def _get_param_from_state_dict(state_dict):
model.summary(input_size=(20), dtype='float32')

def test_summary_non_tensor(self):
paddle.summary(ModelOutter(), input_size=(-1, 3))
paddle.summary(ModelOuter(), input_size=(-1, 3))

def test_summary_nlp(self):
def _get_param_from_state_dict(state_dict):
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def test_fit_by_epoch(self):
base_lr = 1e-3
boundaries = [5, 8]
epochs = 10
wamup_epochs = 4
warmup_epochs = 4

def make_optimizer(parameters=None):
momentum = 0.9
Expand All @@ -1031,7 +1031,7 @@ def make_optimizer(parameters=None):
)
learning_rate = paddle.optimizer.lr.LinearWarmup(
learning_rate=learning_rate,
warmup_steps=wamup_epochs,
warmup_steps=warmup_epochs,
start_lr=base_lr / 5.0,
end_lr=base_lr,
verbose=True,
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def make_optimizer(parameters=None):

cnt = 0
for b in boundaries:
if b + wamup_epochs <= epochs:
if b + warmup_epochs <= epochs:
cnt += 1

np.testing.assert_allclose(
Expand Down Expand Up @@ -1104,7 +1104,7 @@ def make_optimizer(parameters=None):

cnt = 0
for b in boundaries:
if b + wamup_epochs <= epochs:
if b + warmup_epochs <= epochs:
cnt += 1

np.testing.assert_allclose(
Expand Down
8 changes: 4 additions & 4 deletions test/legacy_test/test_sparse_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

class TestGradientAdd(unittest.TestCase):
def sparse(self, sp_x):
indentity = sp_x
identity = sp_x
out = nn.functional.relu(sp_x)
values = out.values() + indentity.values()
values = out.values() + identity.values()
out = paddle.sparse.sparse_coo_tensor(
out.indices(),
values,
Expand All @@ -34,9 +34,9 @@ def sparse(self, sp_x):
return out

def dense(self, x):
indentity = x
identity = x
out = paddle.nn.functional.relu(x)
out = out + indentity
out = out + identity
return out

def test(self):
Expand Down
2 changes: 1 addition & 1 deletion test/mkldnn/test_requantize_mkldnn_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def set_shifts(self):
self.shift_out = 128.0


# ---------------test non-four dimentional formats--------------------------
# ---------------test non-four dimensional formats--------------------------


class TestReQuantizeOp_2DimFormat(TestReQuantizeOp):
Expand Down
4 changes: 2 additions & 2 deletions test/prim/model/bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ def forward(
if token_type_ids is None:
token_type_ids = paddle.zeros_like(input_ids, dtype="int64")

input_embedings = self.word_embeddings(input_ids)
input_embeddings = self.word_embeddings(input_ids)
position_embeddings = self.position_embeddings(position_ids)
token_type_embeddings = self.token_type_embeddings(token_type_ids)

embeddings = (
input_embedings + position_embeddings + token_type_embeddings
input_embeddings + position_embeddings + token_type_embeddings
)
embeddings = self.layer_norm(embeddings)
embeddings = self.dropout(embeddings)
Expand Down
2 changes: 1 addition & 1 deletion test/tokenizer/bert_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def get_special_tokens_mask(
Args:
token_ids_0 (List[int]):
A list of `inputs_ids` for the first sequence.
token_ids_1 (List[int], optinal):
token_ids_1 (List[int], optional):
Optional second list of IDs for sequence pairs. Defaults to None.
already_has_special_tokens (bool, optional): Whether or not the token list is already
formatted with special tokens for the model. Defaults to None.
Expand Down