Skip to content

Commit eced973

Browse files
authored
Merge pull request #11317 from guochaorong/fix_bad_code
Fix bad code in c plus and python
2 parents 637827a + 310598f commit eced973

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

paddle/fluid/operators/gather_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ TEST(Gather, GatherData) {
4343
auto* cpu_place = new paddle::platform::CPUPlace();
4444
paddle::platform::CPUDeviceContext ctx(*cpu_place);
4545
paddle::operators::CPUGather<int>(ctx, *src, *index, output);
46-
46+
delete cpu_place;
47+
cpu_place = NULL;
4748
for (int i = 0; i < 4; ++i) EXPECT_EQ(p_output[i], i + 4);
4849
for (int i = 4; i < 8; ++i) EXPECT_EQ(p_output[i], i - 4);
4950

paddle/fluid/operators/math/math_function_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ TEST(math_function, gemm_trans_clbas) {
7777
paddle::platform::CPUDeviceContext context(*cpu_place);
7878
GetBlas<float>(context).GEMM(false, true, m, n, k, 1, input1_ptr, 3,
7979
input2_ptr + 3, 3, 1, input3_ptr + 1, 4);
80+
delete cpu_place;
81+
cpu_place = NULL;
8082

8183
EXPECT_EQ(input3_ptr[0], 0);
8284
EXPECT_EQ(input3_ptr[1], 24);

python/paddle/fluid/layers/metric.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ def auc(input, label, curve='ROC', num_thresholds=200):
6464
topk_indices = helper.create_tmp_variable(dtype="int64")
6565
topk_out, topk_indices = nn.topk(input, k=k)
6666
auc_out = helper.create_tmp_variable(dtype="float32")
67-
if correct is None:
68-
correct = helper.create_tmp_variable(dtype="int64")
69-
if total is None:
70-
total = helper.create_tmp_variable(dtype="int64")
7167
helper.append_op(
7268
type="accuracy",
7369
inputs={

python/paddle/fluid/tests/unittests/test_dynrnn_gradient_check.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ def update(self, val):
3030
assert val.dtype == self.ex.dtype
3131
self.cur = val
3232

33-
def ex(self):
34-
return self.ex
35-
3633
def next(self):
3734
self.ex = self.cur
3835
self.cur = None

0 commit comments

Comments
 (0)