-
Notifications
You must be signed in to change notification settings - Fork 70
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
No tools for many index operations DArrays #425
Comments
Hi @han-so1omon ,
I think the simplest way to do that is But if you want element-wised comparison of NDArray, it's implemented. Maybe you can fit your code into this form. julia> x = NDArray([1,2,3,4])
4-element mx.NDArray{Int64,1} @ CPU0:
1
2
3
4
julia> y = NDArray([1,2,5,6])
4-element mx.NDArray{Int64,1} @ CPU0:
1
2
5
6
julia> x .== y
4-element mx.NDArray{Int64,1} @ CPU0:
1
1
0
0 About |
From the http://dmlc.ml/MXNet.jl documentation as well as reading source code, the tools for comparison-based index operations on NDArrays are not apparent. Because NDArray is not compatible with common Julia index methods
find()
, etc the alternative is to write a method. However, there is no way to retrieve a conditional out of an NDArray, even an array of ones/zeros.For example how would one find the index of the maximum element of an array? The
mx.maximum()
function returns the maximum element, and themx._equal()
function can do NDArray element-wise comparison. Thus, an NDArray of ones or a single element NDArray is found, but this can't be used as a Julia-compatibleBool
.This seems like a major flaw, and so it must be the case that I'm missing something simple here.
Edit:
argmax()
, etc are in dlmc.ml documentation, but they throw errors:Check failed: mshadow::DataType<DType>::kFlag == type_flag_ TBlob.get_with_shape: data type do not match specified type.Expected: 6 v.s. given 0
...Edit2:
Found the
@mx.nd_as_jl
macro. If this is the only way to do index operations (i.e. whileargmax()
, etc are being fixed/implemented), then it should be highlighted more in documentation.The text was updated successfully, but these errors were encountered: