Skip to content

Commit

Permalink
[MXNET-696] Fix undefined name errors (apache#12137)
Browse files Browse the repository at this point in the history
* Fix undefined name error in neural style example

* Fix import exception error

* Fix undefined name in AUCMetric

* Fix undefined name in a3c example
  • Loading branch information
vandanavk authored and sandeep-krishnamurthy committed Aug 15, 2018
1 parent 3b74347 commit 692076e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions example/deep-embedded-clustering/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import numpy as np
try:
import cPickle as pickle
except ModuleNotFoundError:
except ImportError:
import pickle


Expand Down Expand Up @@ -75,4 +75,4 @@ def load(self, fname):
self.args[key][:] = v

def setup(self, *args, **kwargs):
raise NotImplementedError("must override this")
raise NotImplementedError("must override this")
1 change: 1 addition & 0 deletions example/neural-style/end_to_end/model_vgg19.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def get_executor_with_style(style, content, input_size, ctx):
arg_dict=arg_dict)

def get_executor_content(content, input_size, ctx):
out = mx.sym.Group([content])
arg_shapes, output_shapes, aux_shapes = content.infer_shape(data=(1, 3, input_size[0], input_size[1]))
arg_names = out.list_arguments()
arg_dict = dict(zip(arg_names, [mx.nd.zeros(shape, ctx=ctx) for shape in arg_shapes]))
Expand Down
2 changes: 1 addition & 1 deletion example/reinforcement-learning/a3c/a3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test():
mx.gpu(int(i)) for i in args.gpus.split(',')]

# module
dataiter = robo_data.RobosimsDataIter('scenes', args.batch_size, args.input_length, web_viz=True)
dataiter = rl_data.GymDataIter('scenes', args.batch_size, args.input_length, web_viz=True)
print(dataiter.provide_data)
net = sym.get_symbol_thor(dataiter.act_dim)
module = mx.mod.Module(net, data_names=[d[0] for d in dataiter.provide_data], label_names=('policy_label', 'value_label'), context=devs)
Expand Down
4 changes: 3 additions & 1 deletion example/sparse/factorization_machine/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def update(self, labels, preds):
label_sum = label_weight.sum()
if label_sum == 0 or label_sum == label_weight.size:
raise Exception("AUC with one class is undefined")


label_one_num = np.count_nonzero(label_weight)
label_zero_num = len(label_weight) - label_one_num
total_area = label_zero_num * label_one_num
height = 0
width = 0
Expand Down

0 comments on commit 692076e

Please sign in to comment.