11from __future__ import annotations
22
33from builtins import bool as py_bool
4+ from typing import Literal
45
56import cupy as cp
67
@@ -139,6 +140,15 @@ def take_along_axis(x: Array, indices: Array, /, *, axis: int = -1) -> Array:
139140 return cp .take_along_axis (x , indices , axis = axis )
140141
141142
143+ # https://github.com/cupy/cupy/pull/9582
144+ def broadcast_arrays (* arrays : Array ) -> tuple [Array , ...]:
145+ return tuple (cp .broadcast_arrays (* arrays ))
146+
147+
148+ def meshgrid (* arrays : Array , indexing : Literal ['xy' , 'ij' ] = 'xy' ) -> tuple [Array , ...]:
149+ return tuple (cp .meshgrid (* arrays , indexing = indexing ))
150+
151+
142152# These functions are completely new here. If the library already has them
143153# (i.e., numpy 2.0), use the library version instead of our wrapper.
144154if hasattr (cp , 'vecdot' ):
@@ -161,7 +171,8 @@ def take_along_axis(x: Array, indices: Array, /, *, axis: int = -1) -> Array:
161171 'atan2' , 'atanh' , 'bitwise_left_shift' ,
162172 'bitwise_invert' , 'bitwise_right_shift' ,
163173 'bool' , 'concat' , 'count_nonzero' , 'pow' , 'sign' ,
164- 'ceil' , 'floor' , 'trunc' , 'take_along_axis' ]
174+ 'ceil' , 'floor' , 'trunc' , 'take_along_axis' ,
175+ 'broadcast_arrays' , 'meshgrid' ]
165176
166177
167178def __dir__ () -> list [str ]:
0 commit comments