Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Merged
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
7 changes: 7 additions & 0 deletions tests/nightly/model_backwards_compatibility_check/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
import re
from mxnet.test_utils import assert_almost_equal

try:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmp = lambda(x, y): (x > y) - (x < y) could also work with a bit less code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It is a Python 3 syntax error
  2. With the syntax fixed it generates a PEP8 violation in flake8 https://stackoverflow.com/questions/25010167/e731-do-not-assign-a-lambda-expression-use-a-def

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. Thanks!

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)
Expand Down