Skip to content

Commit

Permalink
[master] Compatible with Python 3.
Browse files Browse the repository at this point in the history
  • Loading branch information
hotpxl authored and jermainewang committed Apr 1, 2016
1 parent 5566db5 commit bd07554
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/mxnet/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,8 @@ def add(lhs, rhs):
elif isinstance(rhs, numeric_types):
return NDArray._plus_scalar(lhs, float(rhs))
elif isinstance(rhs, NDArray):
lsize = reduce(operator.mul, lhs.shape)
rsize = reduce(operator.mul, rhs.shape)
lsize = functools.reduce(operator.mul, lhs.shape)
rsize = functools.reduce(operator.mul, rhs.shape)
if lsize < rsize:
lhs = broadcast_to(lhs, rhs.shape)
elif lsize > rsize:
Expand Down Expand Up @@ -517,8 +517,8 @@ def subtract(lhs, rhs):
elif isinstance(rhs, numeric_types):
return NDArray._minus_scalar(lhs, float(rhs))
elif isinstance(rhs, NDArray):
lsize = reduce(operator.mul, lhs.shape)
rsize = reduce(operator.mul, rhs.shape)
lsize = functools.reduce(operator.mul, lhs.shape)
rsize = functools.reduce(operator.mul, rhs.shape)
if lsize < rsize:
lhs = broadcast_to(lhs, rhs.shape)
elif lsize > rsize:
Expand Down Expand Up @@ -551,8 +551,8 @@ def multiply(lhs, rhs):
elif isinstance(rhs, numeric_types):
return NDArray._mul_scalar(lhs, float(rhs))
elif isinstance(rhs, NDArray):
lsize = reduce(operator.mul, lhs.shape)
rsize = reduce(operator.mul, rhs.shape)
lsize = functools.reduce(operator.mul, lhs.shape)
rsize = functools.reduce(operator.mul, rhs.shape)
if lsize < rsize:
lhs = broadcast_to(lhs, rhs.shape)
elif lsize > rsize:
Expand Down Expand Up @@ -587,8 +587,8 @@ def divide(lhs, rhs):
elif isinstance(rhs, numeric_types):
return NDArray._div_scalar(lhs, float(rhs))
elif isinstance(rhs, NDArray):
lsize = reduce(operator.mul, lhs.shape)
rsize = reduce(operator.mul, rhs.shape)
lsize = functools.reduce(operator.mul, lhs.shape)
rsize = functools.reduce(operator.mul, rhs.shape)
if lsize < rsize:
lhs = broadcast_to(lhs, rhs.shape)
elif lsize > rsize:
Expand Down

0 comments on commit bd07554

Please sign in to comment.