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

dropdims fails #1265

Open
3f6a opened this issue Jun 24, 2024 · 1 comment
Open

dropdims fails #1265

3f6a opened this issue Jun 24, 2024 · 1 comment

Comments

@3f6a
Copy link

3f6a commented Jun 24, 2024

This would work if A were a normal matrix:

julia> A = @SMatrix randn(2,2)
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
 -0.663672  2.31438
  0.166198  1.26303

julia> dropdims(mean(A; dims=2); dims=2)
ERROR: TypeError: in typeassert, expected Tuple{SOneTo{1}}, got a value of type Tuple{SOneTo{2}}
Stacktrace:
 [1] _dropdims(A::SMatrix{2, 1, Float64, 2}, dims::Tuple{Int64})
   @ Base ./abstractarraymath.jl:92
 [2] _dropdims(A::SMatrix{2, 1, Float64, 2}, dim::Int64)
   @ Base ./abstractarraymath.jl:94
 [3] dropdims(A::SMatrix{2, 1, Float64, 2}; dims::Int64)
   @ Base ./abstractarraymath.jl:82
 [4] top-level scope
   @ REPL[26]:1
@charleskawczynski
Copy link

I'm running into the same thing:

julia> mm = MArray{Tuple{3,3,1},Float64}(rand(3,3,1))
3×3×1 MArray{Tuple{3, 3, 1}, Float64, 3, 9} with indices SOneTo(3)×SOneTo(3)×SOneTo(1):
[:, :, 1] =
 0.0306304  0.0559625  0.409032
 0.147117   0.462261   0.614837
 0.20505    0.940826   0.937225

julia> dropdims(mm, dims=3)
ERROR: TypeError: in typeassert, expected Tuple{SOneTo{3}, SOneTo{1}}, got a value of type Tuple{SOneTo{3}, SOneTo{3}}
Stacktrace:
 [1] _dropdims(A::MArray{Tuple{3, 3, 1}, Float64, 3, 9}, dims::Tuple{Int64})
   @ Base ./abstractarraymath.jl:92
 [2] _dropdims(A::MArray{Tuple{3, 3, 1}, Float64, 3, 9}, dim::Int64)
   @ Base ./abstractarraymath.jl:94
 [3] dropdims(A::MArray{Tuple{3, 3, 1}, Float64, 3, 9}; dims::Int64)
   @ Base ./abstractarraymath.jl:82
 [4] top-level scope
   @ REPL[27]:1

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