Skip to content
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

Support view? #16

Open
SkyWorld117 opened this issue Aug 9, 2021 · 2 comments
Open

Support view? #16

SkyWorld117 opened this issue Aug 9, 2021 · 2 comments

Comments

@SkyWorld117
Copy link

It seems the reordering of matrix leads to wrong result.

julia> using VectorizedRNG

julia> m = zeros(Float32, 4,4)
4×4 Matrix{Float32}:
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0

julia> n = view(m, 2:3,2:3)
2×2 view(::Matrix{Float32}, 2:3, 2:3) with eltype Float32:
 0.0  0.0
 0.0  0.0

julia> rand!(local_rng(), n)
2×2 view(::Matrix{Float32}, 2:3, 2:3) with eltype Float32:
 0.383252  0.0
 0.110364  0.0

julia> m
4×4 Matrix{Float32}:
 0.0  0.0       0.943732  0.0
 0.0  0.383252  0.0       0.0
 0.0  0.110364  0.0       0.0
 0.0  0.603976  0.0       0.0
@chriselrod
Copy link
Member

Yeah, it'd be good to use ArrayInterface.dense_dims and ArrayInterface.stride_rank here to do this correctly.

@SkyWorld117
Copy link
Author

Alright, I'll take a look at that. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants