@@ -110,60 +110,54 @@ def _concat_check(tup, dtype, out):
110
110
111
111
### XXX: order the imports DAG
112
112
from . _funcs import normalizer , DTypeLike , ArrayLike
113
- from typing import Optional
113
+ from typing import Optional , Sequence
114
114
115
115
@normalizer
116
- def concatenate (ar_tuple , axis = 0 , out = None , dtype : DTypeLike = None , casting = "same_kind" ):
117
- tensors = _helpers .to_tensors (* ar_tuple )
118
- _concat_check (tensors , dtype , out = out )
119
- result = _impl .concatenate (tensors , axis , out , dtype , casting )
116
+ def concatenate (ar_tuple : Sequence [ArrayLike ], axis = 0 , out = None , dtype : DTypeLike = None , casting = "same_kind" ):
117
+ _concat_check (ar_tuple , dtype , out = out )
118
+ result = _impl .concatenate (ar_tuple , axis , out , dtype , casting )
120
119
return _helpers .result_or_out (result , out )
121
120
122
121
123
122
@normalizer
124
- def vstack (tup , * , dtype : DTypeLike = None , casting = "same_kind" ):
125
- tensors = _helpers .to_tensors (* tup )
126
- _concat_check (tensors , dtype , out = None )
127
- result = _impl .vstack (tensors , dtype = dtype , casting = casting )
123
+ def vstack (tup : Sequence [ArrayLike ], * , dtype : DTypeLike = None , casting = "same_kind" ):
124
+ _concat_check (tup , dtype , out = None )
125
+ result = _impl .vstack (tup , dtype = dtype , casting = casting )
128
126
return asarray (result )
129
127
130
128
131
129
row_stack = vstack
132
130
133
131
134
132
@normalizer
135
- def hstack (tup , * , dtype : DTypeLike = None , casting = "same_kind" ):
136
- tensors = _helpers .to_tensors (* tup )
137
- _concat_check (tensors , dtype , out = None )
138
- result = _impl .hstack (tensors , dtype = dtype , casting = casting )
133
+ def hstack (tup : Sequence [ArrayLike ], * , dtype : DTypeLike = None , casting = "same_kind" ):
134
+ _concat_check (tup , dtype , out = None )
135
+ result = _impl .hstack (tup , dtype = dtype , casting = casting )
139
136
return asarray (result )
140
137
141
138
142
139
@normalizer
143
- def dstack (tup , * , dtype : DTypeLike = None , casting = "same_kind" ):
140
+ def dstack (tup : Sequence [ ArrayLike ] , * , dtype : DTypeLike = None , casting = "same_kind" ):
144
141
# XXX: in numpy 1.24 dstack does not have dtype and casting keywords
145
142
# but {h,v}stack do. Hence add them here for consistency.
146
- tensors = _helpers .to_tensors (* tup )
147
- result = _impl .dstack (tensors , dtype = dtype , casting = casting )
143
+ result = _impl .dstack (tup , dtype = dtype , casting = casting )
148
144
return asarray (result )
149
145
150
146
151
147
@normalizer
152
- def column_stack (tup , * , dtype : DTypeLike = None , casting = "same_kind" ):
148
+ def column_stack (tup : Sequence [ ArrayLike ] , * , dtype : DTypeLike = None , casting = "same_kind" ):
153
149
# XXX: in numpy 1.24 column_stack does not have dtype and casting keywords
154
150
# but row_stack does. (because row_stack is an alias for vstack, really).
155
151
# Hence add these keywords here for consistency.
156
- tensors = _helpers .to_tensors (* tup )
157
- _concat_check (tensors , dtype , out = None )
158
- result = _impl .column_stack (tensors , dtype = dtype , casting = casting )
152
+ _concat_check (tup , dtype , out = None )
153
+ result = _impl .column_stack (tup , dtype = dtype , casting = casting )
159
154
return asarray (result )
160
155
161
156
162
157
@normalizer
163
- def stack (arrays , axis = 0 , out = None , * , dtype : DTypeLike = None , casting = "same_kind" ):
164
- tensors = _helpers .to_tensors (* arrays )
165
- _concat_check (tensors , dtype , out = out )
166
- result = _impl .stack (tensors , axis = axis , out = out , dtype = dtype , casting = casting )
158
+ def stack (arrays : Sequence [ArrayLike ], axis = 0 , out = None , * , dtype : DTypeLike = None , casting = "same_kind" ):
159
+ _concat_check (arrays , dtype , out = out )
160
+ result = _impl .stack (arrays , axis = axis , out = out , dtype = dtype , casting = casting )
167
161
return _helpers .result_or_out (result , out )
168
162
169
163
0 commit comments