-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Math.argmax throwing null pointer exception for my setting. #149
Comments
I looked at the argmax source code..
is it because axes.nativeHandle? |
I believe this is more of an error in the documentation than in the implementation, compare Python Docs. ArgMax along multiple axes would be somewhat confusing as You would have to return a Tensor of shape PR#123 initially included an implementation of |
@DirkToewe I thought so. 'axes.nativeHandle' looks like not being able to handle 'null'. It seems contrary to the documentation. I think it was a technical debt. By the way, my 'argmax' function was numpy's. I was trying to do a similar thing to the red circled practice. |
@cosmir17 @DirkToewe One question is whether we want to have that behavior or whether it is counterintuitive. Also, it can always be achieved with a reshape to flatten followed by an argmax, which in my opinion has better semantics. What do you think? |
@eaplatanios @DirkToewe, I am happy to do the following as DirkToewe demonstrated Nonetheless, either the doc or the implementation can be changed in future PR. |
I couldn't agree more. My vote would be leaving the implementation as is if only for the reason that people coming from Tensorflow4Python have an easier time to adapt. One thing that might be useful in general is a If there is more people like me who need to find a maximum nd-index, it would probably be better to introduce a new method called
No it doesn't. After @eaplatanios brought me to reason, I removed it from the PR. The PR was about a memory leak that was completely unrelated to |
If you guys decide to have a function, I think it would be a better naming to have 'flatten' as normally used in Scala. |
@DirkToewe I wasn't talking about the PR itself. I was specific about the 'null' handling change. I used a parenthesis (null handling) |
Not sure if I know which change You are referring to. The change to the null handling in |
@DirkToewe, the following change, if( null == axes ) Without the above code, argmax function will throw null pointer exception when 'axes' has 'null' value. It wasn't pushed to Master as you pointed out 'PR123 wasn't merged'. I was saying, either the doc(describing null input case) or the method better to be changed. Otherwise, there will be another issue ticket concerning this null case. |
You're absolutely right. My vote would be on changing/fixing the documentation. |
I let you guys (will) decide. |
@cosmir17 @DirkToewe I updated the documentation and it will be included in the next release. Thanks for catching this! :) |
Hi,
I am using Math.argmax and it seems throwing null pointer exception for my setting.
I got the following error:
java.lang.NullPointerException: null
at org.platanios.tensorflow.api.tensors.ops.Math.argmax(Math.scala:1295)
at org.platanios.tensorflow.api.tensors.ops.Math.argmax$(Math.scala:1289)
at org.platanios.tensorflow.api.tensors.ops.Math$.argmax(Math.scala:2102)
at org.platanios.tensorflow.api.tensors.ops.Math.argmax(Math.scala:1278)
at org.platanios.tensorflow.api.tensors.ops.Math.argmax$(Math.scala:1274)
at org.platanios.tensorflow.api.tensors.ops.Math$.argmax(Math.scala:2102)`
'null' value should work as specified in the scala doc :
* @param axes Integer tensor containing the axes to reduce. Ifnull, then all axes are reduced.
I don't know why null pointer exception is seen.
*println(myMatrix) printed on console : Tensor[Float, [1, 3]]
The text was updated successfully, but these errors were encountered: