You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by sk...@apache.org on 2018/08/23 18:43:18 UTC

[incubator-mxnet] branch master updated: [MXNET-696] Define cmp() in Python 3 again (#12295)

This is an automated email from the ASF dual-hosted git repository.

skm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 4664a30  [MXNET-696] Define cmp() in Python 3 again (#12295)
4664a30 is described below

commit 4664a3005db259d9220fd843540d515a7d3d6036
Author: cclauss <cc...@bluewin.ch>
AuthorDate: Thu Aug 23 20:43:05 2018 +0200

    [MXNET-696] Define cmp() in Python 3 again (#12295)
---
 tests/nightly/model_backwards_compatibility_check/common.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/nightly/model_backwards_compatibility_check/common.py b/tests/nightly/model_backwards_compatibility_check/common.py
index 8950a92..d8ffca2 100644
--- a/tests/nightly/model_backwards_compatibility_check/common.py
+++ b/tests/nightly/model_backwards_compatibility_check/common.py
@@ -29,6 +29,13 @@ from mxnet.gluon import nn
 import re
 from mxnet.test_utils import assert_almost_equal
 
+try:
+    cmp             # Python 2
+except NameError:
+    # See: https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons
+    def cmp(x, y):  # Python 3
+        return (x > y) - (x < y)
+
 # Set fixed random seeds.
 mx.random.seed(7)
 np.random.seed(7)