-
Notifications
You must be signed in to change notification settings - Fork 230
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
KnetArray linear indexing does not work #32
Comments
You can implement this as x[1:3]. Do you need non-contiguous indices? |
Currently only Integer, Range, or Colon indices are supported for KnetArray. To get the rest to work, we need to complete the missing getindex methods. In Julia, a[[1,3,5]] calls:
and a[[true,false,true]] calls:
These need to be ported to KnetArrays. We get them for free if we inherit from AbstractArray, but that has other problems such as inefficient operations getting called inadvertently on KnetArrays. However as a temporary workaround you can try modifying the type declaration of KnetArray in karray.jl to inherit from AbstractArray:
|
Implemented the following indexing options:
|
a = randn(256,10000); x = convert(Knet.KnetArray, a); x[[1,2,3]]
creates the following error:ERROR: MethodError: no method matching getindex(::Knet.KnetArray{Float64,2}, ::Array{Int64,1})
The text was updated successfully, but these errors were encountered: