diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2019-06-01 23:39:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-01 23:39:54 -0400 |
commit | 52ddda6e253a2c5e16b3933462ed7e4778ca76f9 (patch) | |
tree | a886e0e63259237eb748538b01cac565240e730a /numpy/lib/shape_base.py | |
parent | 4b4eaa666b18016162c144b7757ba40d8237fdb8 (diff) | |
download | numpy-52ddda6e253a2c5e16b3933462ed7e4778ca76f9.tar.gz |
MAINT: speed up [hvd]stack by eliminating list comprehension. (#13697)
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r-- | numpy/lib/shape_base.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 10f567bb4..a5d0040aa 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -700,7 +700,10 @@ def dstack(tup): # raise warning if necessary _arrays_for_stack_dispatcher(tup, stacklevel=2) - return _nx.concatenate([atleast_3d(_m) for _m in tup], 2) + arrs = atleast_3d(*tup) + if not isinstance(arrs, list): + arrs = [arrs] + return _nx.concatenate(arrs, 2) def _replace_zero_by_x_arrays(sub_arys): |