# Super Squeeze

**URL:** <https://discourse.julialang.org/t/super-squeeze/6986>\
**Category:** General Usage\
**Created:** [November 9, 2017, 11:44pm UTC](https://discourse.julialang.org/t/super-squeeze/6986 "2017-11-09T23:44:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrielgellner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gabrielgellner/32/75_2.png) [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Post date:** [November 9, 2017, 11:44pm UTC](https://discourse.julialang.org/t/super-squeeze/6986/1 "2017-11-09T23:44:11Z")

</div>

two related questions.

1. If I have an array with many size 1 dimensions why doesn’t `squeeze(arr)` find the one dimensions and remove them automatically?

2. And given it doesn’t what is the best way to make this behavior? I do `squeeze(arr, tuple(find(size(test) .== 1)...))` which makes me shudder.

---

<div class="post-metadata">

**Author:** ![tlnagy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlnagy/32/5815_2.png) [@tlnagy](https://discourse.julialang.org/u/tlnagy)\
**Post date:** [November 10, 2017, 1:15am UTC](https://discourse.julialang.org/t/super-squeeze/6986/2 "2017-11-10T01:15:31Z")

</div>

I’m not sure why `squeeze` doesn’t have the option to remove all dimensions of length 1 automatically. I think we should define a `squeeze(A)` which removes all axes that have length one while keeping the currently definition of `squeeze(A, dim)` to drop specific ones.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [November 10, 2017, 2:10am UTC](https://discourse.julialang.org/t/super-squeeze/6986/3 "2017-11-10T02:10:35Z")

</div>

I think the reasoning was that `squeeze(arr)` is type-unstable, so it’s best to avoid functions that have fundamentally poor performance.

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [November 10, 2017, 3:01am UTC](https://discourse.julialang.org/t/super-squeeze/6986/4 "2017-11-10T03:01:14Z")

</div>

Also see discussions in PRs here [#22000](https://github.com/JuliaLang/julia/pull/22000) and [#23500](https://github.com/JuliaLang/julia/pull/23500)
