Prompt48 commited on
Commit
bdc2fe5
·
verified ·
1 Parent(s): f97c385

Upload edit\Qwen3-TTS-test\.venv\Lib\site-packages\sklearn\externals\array_api_compat\dask\array\linalg.py with huggingface_hub

Browse files
edit//Qwen3-TTS-test//.venv//Lib//site-packages//sklearn//externals//array_api_compat//dask//array//linalg.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from typing import Literal
4
+
5
+ import dask.array as da
6
+
7
+ # The `matmul` and `tensordot` functions are in both the main and linalg namespaces
8
+ from dask.array import matmul, outer, tensordot
9
+
10
+ # Exports
11
+ from dask.array.linalg import * # noqa: F403
12
+
13
+ from ..._internal import get_xp
14
+ from ...common import _linalg
15
+ from ...common._typing import Array as _Array
16
+ from ._aliases import matrix_transpose, vecdot
17
+
18
+ # dask.array.linalg doesn't have __all__. If it is added, replace this with
19
+ #
20
+ # from dask.array.linalg import __all__ as linalg_all
21
+ _n = {}
22
+ exec('from dask.array.linalg import *', _n)
23
+ for k in ('__builtins__', 'annotations', 'operator', 'warnings', 'Array'):
24
+ _n.pop(k, None)
25
+ linalg_all = list(_n)
26
+ del _n, k
27
+
28
+ EighResult = _linalg.EighResult
29
+ QRResult = _linalg.QRResult
30
+ SlogdetResult = _linalg.SlogdetResult
31
+ SVDResult = _linalg.SVDResult
32
+ # TODO: use the QR wrapper once dask
33
+ # supports the mode keyword on QR
34
+ # https://github.com/dask/dask/issues/10388
35
+ #qr = get_xp(da)(_linalg.qr)
36
+ def qr(
37
+ x: _Array,
38
+ mode: Literal["reduced", "complete"] = "reduced",
39
+ **kwargs: object,
40
+ ) -> QRResult:
41
+ if mode != "reduced":
42
+ raise ValueError("dask arrays only support using mode='reduced'")
43
+ return QRResult(*da.linalg.qr(x, **kwargs))
44
+ trace = get_xp(da)(_linalg.trace)
45
+ cholesky = get_xp(da)(_linalg.cholesky)
46
+ matrix_rank = get_xp(da)(_linalg.matrix_rank)
47
+ matrix_norm = get_xp(da)(_linalg.matrix_norm)
48
+
49
+
50
+ # Wrap the svd functions to not pass full_matrices to dask
51
+ # when full_matrices=False (as that is the default behavior for dask),
52
+ # and dask doesn't have the full_matrices keyword
53
+ def svd(x: _Array, full_matrices: bool = True, **kwargs) -> SVDResult:
54
+ if full_matrices:
55
+ raise ValueError("full_matrics=True is not supported by dask.")
56
+ return da.linalg.svd(x, coerce_signs=False, **kwargs)
57
+
58
+ def svdvals(x: _Array) -> _Array:
59
+ # TODO: can't avoid computing U or V for dask
60
+ _, s, _ = svd(x)
61
+ return s
62
+
63
+ vector_norm = get_xp(da)(_linalg.vector_norm)
64
+ diagonal = get_xp(da)(_linalg.diagonal)
65
+
66
+ __all__ = linalg_all + ["trace", "outer", "matmul", "tensordot",
67
+ "matrix_transpose", "vecdot", "EighResult",
68
+ "QRResult", "SlogdetResult", "SVDResult", "qr",
69
+ "cholesky", "matrix_rank", "matrix_norm", "svdvals",
70
+ "vector_norm", "diagonal"]
71
+
72
+ _all_ignore = ['get_xp', 'da', 'linalg_all', 'warnings']