Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

replace has_key by in #8317

Merged
merged 3 commits into from
Nov 19, 2017
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
2 changes: 1 addition & 1 deletion python/mxnet/notebook/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def _process_batch(self, param, df_name):
metrics = {}
metrics['elapsed'] = datetime.datetime.now() - self.start_time
for key, value in metrics.items():
if not self._data[df_name].has_key(key):
if key not in self._data[df_name]:
self._data[df_name][key] = []
self._data[df_name][key].append(value)

Expand Down
2 changes: 1 addition & 1 deletion tests/nightly/TestDoc/doc_spell_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def check_doc(file_content, spell_checker, spell_check_ret):
"""
spell_checker.set_text(file_content)
for error in spell_checker:
if spell_check_ret.has_key(error.word):
if error.word in spell_check_ret:
spell_check_ret[error.word] += 1
else:
spell_check_ret[error.word] = 1
Expand Down
2 changes: 1 addition & 1 deletion tools/accnn/rank_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_ranksel(model, ratio):
if nxt_c > EC:
continue
nxt_v = dp[now][now_c] + math.log(S[i][d])
if dp[nxt].has_key(nxt_c):
if nxt_c in dp[nxt]:
if nxt_v > dp[nxt][nxt_c]:
dp[nxt][nxt_c] = nxt_v
dpc[i][nxt_c] = (d,now_c)
Expand Down
5 changes: 3 additions & 2 deletions tools/accnn/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import json
import ast


def load_model(args):
devs = mx.cpu() if args.gpus == None else [mx.gpu(int(i)) for i in args.gpus.split(',')]
return mx.model.FeedForward.load(args.model, args.load_epoch, ctx=devs)
Expand All @@ -29,7 +30,7 @@ def topsort(nodes):
deg = [0]*n
g = [[] for _ in xrange(n)]
for i,node in enumerate(nodes):
if node.has_key('inputs'):
if 'inputs' in node:
for j in node['inputs']:
deg[i] += 1
g[j[0]].append(i)
Expand All @@ -45,7 +46,7 @@ def topsort(nodes):
q.append(j)
new_ids=dict([(node['name'],i) for i,node in enumerate(res)])
for node in res:
if node.has_key('inputs'):
if 'inputs' in node:
for j in node['inputs']:
j[0]=new_ids[nodes[j[0]]['name']]
return res
Expand Down