Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[WIP] scalar support for unary ndarray, ie. nd.sqrt(2), nd.log(3) #4877

Closed
wants to merge 1 commit into from
Closed

Conversation

ZihengJiang
Copy link
Contributor

ref #4844

BTW, it looks like MXNet.NDArray only accept array-like data, so nd.sqrt(2) will return array([1.41421354]) instead of array(1.41421354)

@piiswrong
Copy link
Contributor

why not just float(1.414)

@@ -97,6 +121,11 @@ def generic_ndarray_function(*args, **kwargs):
for i in args:
if isinstance(i, NDArrayBase):
ndargs.append(i)
elif num_args.value == 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't valid. It breaks mx.nd.arange()
I think you should fix this by falling back on minpy side

Copy link
Contributor

Choose a reason for hiding this comment

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

or at least check if this argument type is NDArray|Symbol

@ZihengJiang
Copy link
Contributor Author

ZihengJiang commented Feb 6, 2017

yes, I think it's easy to solve this on the MinPy side, but do you agree to make MXNet.NDArray to support such usage? @piiswrong

@piiswrong
Copy link
Contributor

We can make NDArray support scalar, but you need to check for argument type ("NDArray or Symbol") to make sure it's not meant to be a kwarg

@mli
Copy link
Member

mli commented Mar 15, 2017

closed due to no recent activity. please feel free to reopen it.

@mli mli closed this Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants