Skip to content

Commit abb7dee

Browse files
committed
optimize test_lookup_table_op.py
1 parent e64dda7 commit abb7dee

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,18 @@ def check_with_place(self, place):
115115
w_array = np.ones((len(rows), row_numel)).astype("float32")
116116
for i in range(len(rows)):
117117
w_array[i] *= i
118-
ids_tensor = w_selected_rows.get_tensor()
119-
ids_tensor.set(w_array, place)
118+
w_tensor = w_selected_rows.get_tensor()
119+
w_tensor.set(w_array, place)
120120

121121
# create Out Variable
122-
Out_tensor = scope.var('Out').get_tensor()
122+
out_tensor = scope.var('Out').get_tensor()
123123

124124
# create and run lookup_table operator
125125
lookup_table = Operator("lookup_table", W='W', Ids='Ids', Out='Out')
126126
lookup_table.run(scope, place)
127127

128128
# get result from Out
129-
result_array = np.array(Out_tensor)
129+
result_array = np.array(out_tensor)
130130
# all(): return True if all elements of the iterable are true (or if the iterable is empty)
131131
for idx, row in enumerate(ids_array):
132132
assert (row[0] == result_array[idx]).all()

0 commit comments

Comments
 (0)