You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/15 20:23:44 UTC

[GitHub] sandeep-krishnamurthy closed pull request #12137: [MXNET-696] Fix undefined name errors

sandeep-krishnamurthy closed pull request #12137: [MXNET-696] Fix undefined name errors
URL: https://github.com/apache/incubator-mxnet/pull/12137
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/example/deep-embedded-clustering/model.py b/example/deep-embedded-clustering/model.py
index 777634e3cf8..9b6185c9fd1 100644
--- a/example/deep-embedded-clustering/model.py
+++ b/example/deep-embedded-clustering/model.py
@@ -22,7 +22,7 @@
 import numpy as np
 try:
     import cPickle as pickle
-except ModuleNotFoundError:
+except ImportError:
     import pickle
 
 
@@ -75,4 +75,4 @@ def load(self, fname):
                     self.args[key][:] = v
 
     def setup(self, *args, **kwargs):
-        raise NotImplementedError("must override this")
\ No newline at end of file
+        raise NotImplementedError("must override this")
diff --git a/example/neural-style/end_to_end/model_vgg19.py b/example/neural-style/end_to_end/model_vgg19.py
index 0d369ae08f5..1bc38766beb 100644
--- a/example/neural-style/end_to_end/model_vgg19.py
+++ b/example/neural-style/end_to_end/model_vgg19.py
@@ -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]))
diff --git a/example/reinforcement-learning/a3c/a3c.py b/example/reinforcement-learning/a3c/a3c.py
index f74ce77b652..c100f61304d 100644
--- a/example/reinforcement-learning/a3c/a3c.py
+++ b/example/reinforcement-learning/a3c/a3c.py
@@ -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)
diff --git a/example/sparse/factorization_machine/metric.py b/example/sparse/factorization_machine/metric.py
index 05ef04a0c48..a8c52c781c0 100644
--- a/example/sparse/factorization_machine/metric.py
+++ b/example/sparse/factorization_machine/metric.py
@@ -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


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services