MCPcopy Create free account
hub / github.com/dask/dask / register_cupyx

Function register_cupyx

dask/array/backends.py:168–192  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

166@tensordot_lookup.register_lazy("cupyx")
167@concatenate_lookup.register_lazy("cupyx")
168def register_cupyx():
169 from cupyx.scipy.sparse import spmatrix
170
171 try:
172 from cupyx.scipy.sparse import hstack, vstack
173 except ImportError as e:
174 raise type(e)(
175 "Stacking of sparse arrays requires at least CuPy version 8.0.0"
176 ) from e
177
178 def _concat_cupy_sparse(L, axis=0):
179 if axis == 0:
180 return vstack(L)
181 elif axis == 1:
182 return hstack(L)
183 else:
184 msg = (
185 "Can only concatenate cupy sparse matrices for axis in "
186 f"{{0, 1}}. Got {axis}"
187 )
188 raise ValueError(msg)
189
190 concatenate_lookup.register(spmatrix, _concat_cupy_sparse)
191 tensordot_lookup.register(spmatrix, _tensordot_scipy_sparse)
192 take_lookup.register(spmatrix, sparse_take)
193
194
195@tensordot_lookup.register_lazy("sparse")

Callers

nothing calls this directly

Calls 1

registerMethod · 0.45

Tested by

no test coverage detected