ZTWHHH commited on
Commit
0d9be61
·
verified ·
1 Parent(s): 9eb1958

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. parrot/lib/python3.10/site-packages/scipy/signal/_bsplines.py +519 -0
  2. parrot/lib/python3.10/site-packages/scipy/signal/_peak_finding.py +1312 -0
  3. parrot/lib/python3.10/site-packages/scipy/signal/lti_conversion.py +20 -0
  4. parrot/lib/python3.10/site-packages/scipy/signal/tests/__init__.py +0 -0
  5. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_conj_compositeexplicitautograd_dispatch.h +23 -0
  6. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_flash_attention_forward.h +47 -0
  7. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_cosh_native.h +25 -0
  8. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_sin.h +44 -0
  9. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_new_zeros_with_same_feature_meta_compositeexplicitautograd_dispatch.h +25 -0
  10. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_nnz_ops.h +28 -0
  11. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_mm_ops.h +39 -0
  12. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_thnn_fused_gru_cell_backward.h +39 -0
  13. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_unique.h +39 -0
  14. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/adaptive_max_pool2d_meta.h +27 -0
  15. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/aminmax_cpu_dispatch.h +25 -0
  16. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/atan_cuda_dispatch.h +26 -0
  17. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/baddbmm_native.h +27 -0
  18. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/bmm_ops.h +39 -0
  19. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/diag_embed_compositeexplicitautograd_dispatch.h +24 -0
  20. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_irfftn_ops.h +39 -0
  21. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/full_ops.h +61 -0
  22. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/gelu_compositeexplicitautogradnonfunctional_dispatch.h +24 -0
  23. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/gru.h +35 -0
  24. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/histc_cuda_dispatch.h +25 -0
  25. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/kron.h +39 -0
  26. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/lgamma_cpu_dispatch.h +26 -0
  27. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/log_sigmoid_native.h +22 -0
  28. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logical_not_ops.h +50 -0
  29. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/matmul_backward_compositeexplicitautograd_dispatch.h +24 -0
  30. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mkldnn_max_pool2d_compositeexplicitautograd_dispatch.h +24 -0
  31. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/multilabel_margin_loss_forward_cuda_dispatch.h +25 -0
  32. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nonzero_numpy_ops.h +28 -0
  33. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pad.h +47 -0
  34. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/refine_names_compositeimplicitautograd_dispatch.h +23 -0
  35. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/reflection_pad1d_native.h +27 -0
  36. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/remainder_meta_dispatch.h +26 -0
  37. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/scalar_tensor.h +43 -0
  38. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_entr_meta_dispatch.h +25 -0
  39. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_entr_ops.h +39 -0
  40. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sum_meta.h +27 -0
  41. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_dense_ops.h +28 -0
  42. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/trunc_cpu_dispatch.h +26 -0
  43. videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/unsqueeze.h +30 -0
  44. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/__pycache__/__init__.cpython-310.pyc +0 -0
  45. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/__init__.cpython-310.pyc +0 -0
  46. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/config.cpython-310.pyc +0 -0
  47. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/core.cpython-310.pyc +0 -0
  48. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/data.cpython-310.pyc +0 -0
  49. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/dataclasses.cpython-310.pyc +0 -0
  50. vllm/lib/python3.10/site-packages/ray/_private/thirdparty/pathspec/compat.py +38 -0
parrot/lib/python3.10/site-packages/scipy/signal/_bsplines.py ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy import (asarray, pi, zeros_like,
2
+ array, arctan2, tan, ones, arange, floor,
3
+ r_, atleast_1d, sqrt, exp, greater, cos, add, sin)
4
+
5
+ # From splinemodule.c
6
+ from ._spline import cspline2d, sepfir2d
7
+ from ._signaltools import lfilter, sosfilt, lfiltic
8
+
9
+ from scipy.interpolate import BSpline
10
+
11
+ __all__ = ['spline_filter', 'gauss_spline',
12
+ 'cspline1d', 'qspline1d', 'cspline1d_eval', 'qspline1d_eval']
13
+
14
+
15
+ def spline_filter(Iin, lmbda=5.0):
16
+ """Smoothing spline (cubic) filtering of a rank-2 array.
17
+
18
+ Filter an input data set, `Iin`, using a (cubic) smoothing spline of
19
+ fall-off `lmbda`.
20
+
21
+ Parameters
22
+ ----------
23
+ Iin : array_like
24
+ input data set
25
+ lmbda : float, optional
26
+ spline smooghing fall-off value, default is `5.0`.
27
+
28
+ Returns
29
+ -------
30
+ res : ndarray
31
+ filtered input data
32
+
33
+ Examples
34
+ --------
35
+ We can filter an multi dimensional signal (ex: 2D image) using cubic
36
+ B-spline filter:
37
+
38
+ >>> import numpy as np
39
+ >>> from scipy.signal import spline_filter
40
+ >>> import matplotlib.pyplot as plt
41
+ >>> orig_img = np.eye(20) # create an image
42
+ >>> orig_img[10, :] = 1.0
43
+ >>> sp_filter = spline_filter(orig_img, lmbda=0.1)
44
+ >>> f, ax = plt.subplots(1, 2, sharex=True)
45
+ >>> for ind, data in enumerate([[orig_img, "original image"],
46
+ ... [sp_filter, "spline filter"]]):
47
+ ... ax[ind].imshow(data[0], cmap='gray_r')
48
+ ... ax[ind].set_title(data[1])
49
+ >>> plt.tight_layout()
50
+ >>> plt.show()
51
+
52
+ """
53
+ intype = Iin.dtype.char
54
+ hcol = array([1.0, 4.0, 1.0], 'f') / 6.0
55
+ if intype in ['F', 'D']:
56
+ Iin = Iin.astype('F')
57
+ ckr = cspline2d(Iin.real, lmbda)
58
+ cki = cspline2d(Iin.imag, lmbda)
59
+ outr = sepfir2d(ckr, hcol, hcol)
60
+ outi = sepfir2d(cki, hcol, hcol)
61
+ out = (outr + 1j * outi).astype(intype)
62
+ elif intype in ['f', 'd']:
63
+ ckr = cspline2d(Iin, lmbda)
64
+ out = sepfir2d(ckr, hcol, hcol)
65
+ out = out.astype(intype)
66
+ else:
67
+ raise TypeError("Invalid data type for Iin")
68
+ return out
69
+
70
+
71
+ _splinefunc_cache = {}
72
+
73
+
74
+ def gauss_spline(x, n):
75
+ r"""Gaussian approximation to B-spline basis function of order n.
76
+
77
+ Parameters
78
+ ----------
79
+ x : array_like
80
+ a knot vector
81
+ n : int
82
+ The order of the spline. Must be non-negative, i.e., n >= 0
83
+
84
+ Returns
85
+ -------
86
+ res : ndarray
87
+ B-spline basis function values approximated by a zero-mean Gaussian
88
+ function.
89
+
90
+ Notes
91
+ -----
92
+ The B-spline basis function can be approximated well by a zero-mean
93
+ Gaussian function with standard-deviation equal to :math:`\sigma=(n+1)/12`
94
+ for large `n` :
95
+
96
+ .. math:: \frac{1}{\sqrt {2\pi\sigma^2}}exp(-\frac{x^2}{2\sigma})
97
+
98
+ References
99
+ ----------
100
+ .. [1] Bouma H., Vilanova A., Bescos J.O., ter Haar Romeny B.M., Gerritsen
101
+ F.A. (2007) Fast and Accurate Gaussian Derivatives Based on B-Splines. In:
102
+ Sgallari F., Murli A., Paragios N. (eds) Scale Space and Variational
103
+ Methods in Computer Vision. SSVM 2007. Lecture Notes in Computer
104
+ Science, vol 4485. Springer, Berlin, Heidelberg
105
+ .. [2] http://folk.uio.no/inf3330/scripting/doc/python/SciPy/tutorial/old/node24.html
106
+
107
+ Examples
108
+ --------
109
+ We can calculate B-Spline basis functions approximated by a gaussian
110
+ distribution:
111
+
112
+ >>> import numpy as np
113
+ >>> from scipy.signal import gauss_spline
114
+ >>> knots = np.array([-1.0, 0.0, -1.0])
115
+ >>> gauss_spline(knots, 3)
116
+ array([0.15418033, 0.6909883, 0.15418033]) # may vary
117
+
118
+ """
119
+ x = asarray(x)
120
+ signsq = (n + 1) / 12.0
121
+ return 1 / sqrt(2 * pi * signsq) * exp(-x ** 2 / 2 / signsq)
122
+
123
+
124
+ def _cubic(x):
125
+ x = asarray(x, dtype=float)
126
+ b = BSpline.basis_element([-2, -1, 0, 1, 2], extrapolate=False)
127
+ out = b(x)
128
+ out[(x < -2) | (x > 2)] = 0
129
+ return out
130
+
131
+
132
+ def _quadratic(x):
133
+ x = abs(asarray(x, dtype=float))
134
+ b = BSpline.basis_element([-1.5, -0.5, 0.5, 1.5], extrapolate=False)
135
+ out = b(x)
136
+ out[(x < -1.5) | (x > 1.5)] = 0
137
+ return out
138
+
139
+
140
+ def _coeff_smooth(lam):
141
+ xi = 1 - 96 * lam + 24 * lam * sqrt(3 + 144 * lam)
142
+ omeg = arctan2(sqrt(144 * lam - 1), sqrt(xi))
143
+ rho = (24 * lam - 1 - sqrt(xi)) / (24 * lam)
144
+ rho = rho * sqrt((48 * lam + 24 * lam * sqrt(3 + 144 * lam)) / xi)
145
+ return rho, omeg
146
+
147
+
148
+ def _hc(k, cs, rho, omega):
149
+ return (cs / sin(omega) * (rho ** k) * sin(omega * (k + 1)) *
150
+ greater(k, -1))
151
+
152
+
153
+ def _hs(k, cs, rho, omega):
154
+ c0 = (cs * cs * (1 + rho * rho) / (1 - rho * rho) /
155
+ (1 - 2 * rho * rho * cos(2 * omega) + rho ** 4))
156
+ gamma = (1 - rho * rho) / (1 + rho * rho) / tan(omega)
157
+ ak = abs(k)
158
+ return c0 * rho ** ak * (cos(omega * ak) + gamma * sin(omega * ak))
159
+
160
+
161
+ def _cubic_smooth_coeff(signal, lamb):
162
+ rho, omega = _coeff_smooth(lamb)
163
+ cs = 1 - 2 * rho * cos(omega) + rho * rho
164
+ K = len(signal)
165
+ k = arange(K)
166
+
167
+ zi_2 = (_hc(0, cs, rho, omega) * signal[0] +
168
+ add.reduce(_hc(k + 1, cs, rho, omega) * signal))
169
+ zi_1 = (_hc(0, cs, rho, omega) * signal[0] +
170
+ _hc(1, cs, rho, omega) * signal[1] +
171
+ add.reduce(_hc(k + 2, cs, rho, omega) * signal))
172
+
173
+ # Forward filter:
174
+ # for n in range(2, K):
175
+ # yp[n] = (cs * signal[n] + 2 * rho * cos(omega) * yp[n - 1] -
176
+ # rho * rho * yp[n - 2])
177
+ zi = lfiltic(cs, r_[1, -2 * rho * cos(omega), rho * rho], r_[zi_1, zi_2])
178
+ zi = zi.reshape(1, -1)
179
+
180
+ sos = r_[cs, 0, 0, 1, -2 * rho * cos(omega), rho * rho]
181
+ sos = sos.reshape(1, -1)
182
+
183
+ yp, _ = sosfilt(sos, signal[2:], zi=zi)
184
+ yp = r_[zi_2, zi_1, yp]
185
+
186
+ # Reverse filter:
187
+ # for n in range(K - 3, -1, -1):
188
+ # y[n] = (cs * yp[n] + 2 * rho * cos(omega) * y[n + 1] -
189
+ # rho * rho * y[n + 2])
190
+
191
+ zi_2 = add.reduce((_hs(k, cs, rho, omega) +
192
+ _hs(k + 1, cs, rho, omega)) * signal[::-1])
193
+ zi_1 = add.reduce((_hs(k - 1, cs, rho, omega) +
194
+ _hs(k + 2, cs, rho, omega)) * signal[::-1])
195
+
196
+ zi = lfiltic(cs, r_[1, -2 * rho * cos(omega), rho * rho], r_[zi_1, zi_2])
197
+ zi = zi.reshape(1, -1)
198
+ y, _ = sosfilt(sos, yp[-3::-1], zi=zi)
199
+ y = r_[y[::-1], zi_1, zi_2]
200
+ return y
201
+
202
+
203
+ def _cubic_coeff(signal):
204
+ zi = -2 + sqrt(3)
205
+ K = len(signal)
206
+ powers = zi ** arange(K)
207
+
208
+ if K == 1:
209
+ yplus = signal[0] + zi * add.reduce(powers * signal)
210
+ output = zi / (zi - 1) * yplus
211
+ return atleast_1d(output)
212
+
213
+ # Forward filter:
214
+ # yplus[0] = signal[0] + zi * add.reduce(powers * signal)
215
+ # for k in range(1, K):
216
+ # yplus[k] = signal[k] + zi * yplus[k - 1]
217
+
218
+ state = lfiltic(1, r_[1, -zi], atleast_1d(add.reduce(powers * signal)))
219
+
220
+ b = ones(1)
221
+ a = r_[1, -zi]
222
+ yplus, _ = lfilter(b, a, signal, zi=state)
223
+
224
+ # Reverse filter:
225
+ # output[K - 1] = zi / (zi - 1) * yplus[K - 1]
226
+ # for k in range(K - 2, -1, -1):
227
+ # output[k] = zi * (output[k + 1] - yplus[k])
228
+ out_last = zi / (zi - 1) * yplus[K - 1]
229
+ state = lfiltic(-zi, r_[1, -zi], atleast_1d(out_last))
230
+
231
+ b = asarray([-zi])
232
+ output, _ = lfilter(b, a, yplus[-2::-1], zi=state)
233
+ output = r_[output[::-1], out_last]
234
+ return output * 6.0
235
+
236
+
237
+ def _quadratic_coeff(signal):
238
+ zi = -3 + 2 * sqrt(2.0)
239
+ K = len(signal)
240
+ powers = zi ** arange(K)
241
+
242
+ if K == 1:
243
+ yplus = signal[0] + zi * add.reduce(powers * signal)
244
+ output = zi / (zi - 1) * yplus
245
+ return atleast_1d(output)
246
+
247
+ # Forward filter:
248
+ # yplus[0] = signal[0] + zi * add.reduce(powers * signal)
249
+ # for k in range(1, K):
250
+ # yplus[k] = signal[k] + zi * yplus[k - 1]
251
+
252
+ state = lfiltic(1, r_[1, -zi], atleast_1d(add.reduce(powers * signal)))
253
+
254
+ b = ones(1)
255
+ a = r_[1, -zi]
256
+ yplus, _ = lfilter(b, a, signal, zi=state)
257
+
258
+ # Reverse filter:
259
+ # output[K - 1] = zi / (zi - 1) * yplus[K - 1]
260
+ # for k in range(K - 2, -1, -1):
261
+ # output[k] = zi * (output[k + 1] - yplus[k])
262
+ out_last = zi / (zi - 1) * yplus[K - 1]
263
+ state = lfiltic(-zi, r_[1, -zi], atleast_1d(out_last))
264
+
265
+ b = asarray([-zi])
266
+ output, _ = lfilter(b, a, yplus[-2::-1], zi=state)
267
+ output = r_[output[::-1], out_last]
268
+ return output * 8.0
269
+
270
+
271
+ def cspline1d(signal, lamb=0.0):
272
+ """
273
+ Compute cubic spline coefficients for rank-1 array.
274
+
275
+ Find the cubic spline coefficients for a 1-D signal assuming
276
+ mirror-symmetric boundary conditions. To obtain the signal back from the
277
+ spline representation mirror-symmetric-convolve these coefficients with a
278
+ length 3 FIR window [1.0, 4.0, 1.0]/ 6.0 .
279
+
280
+ Parameters
281
+ ----------
282
+ signal : ndarray
283
+ A rank-1 array representing samples of a signal.
284
+ lamb : float, optional
285
+ Smoothing coefficient, default is 0.0.
286
+
287
+ Returns
288
+ -------
289
+ c : ndarray
290
+ Cubic spline coefficients.
291
+
292
+ See Also
293
+ --------
294
+ cspline1d_eval : Evaluate a cubic spline at the new set of points.
295
+
296
+ Examples
297
+ --------
298
+ We can filter a signal to reduce and smooth out high-frequency noise with
299
+ a cubic spline:
300
+
301
+ >>> import numpy as np
302
+ >>> import matplotlib.pyplot as plt
303
+ >>> from scipy.signal import cspline1d, cspline1d_eval
304
+ >>> rng = np.random.default_rng()
305
+ >>> sig = np.repeat([0., 1., 0.], 100)
306
+ >>> sig += rng.standard_normal(len(sig))*0.05 # add noise
307
+ >>> time = np.linspace(0, len(sig))
308
+ >>> filtered = cspline1d_eval(cspline1d(sig), time)
309
+ >>> plt.plot(sig, label="signal")
310
+ >>> plt.plot(time, filtered, label="filtered")
311
+ >>> plt.legend()
312
+ >>> plt.show()
313
+
314
+ """
315
+ if lamb != 0.0:
316
+ return _cubic_smooth_coeff(signal, lamb)
317
+ else:
318
+ return _cubic_coeff(signal)
319
+
320
+
321
+ def qspline1d(signal, lamb=0.0):
322
+ """Compute quadratic spline coefficients for rank-1 array.
323
+
324
+ Parameters
325
+ ----------
326
+ signal : ndarray
327
+ A rank-1 array representing samples of a signal.
328
+ lamb : float, optional
329
+ Smoothing coefficient (must be zero for now).
330
+
331
+ Returns
332
+ -------
333
+ c : ndarray
334
+ Quadratic spline coefficients.
335
+
336
+ See Also
337
+ --------
338
+ qspline1d_eval : Evaluate a quadratic spline at the new set of points.
339
+
340
+ Notes
341
+ -----
342
+ Find the quadratic spline coefficients for a 1-D signal assuming
343
+ mirror-symmetric boundary conditions. To obtain the signal back from the
344
+ spline representation mirror-symmetric-convolve these coefficients with a
345
+ length 3 FIR window [1.0, 6.0, 1.0]/ 8.0 .
346
+
347
+ Examples
348
+ --------
349
+ We can filter a signal to reduce and smooth out high-frequency noise with
350
+ a quadratic spline:
351
+
352
+ >>> import numpy as np
353
+ >>> import matplotlib.pyplot as plt
354
+ >>> from scipy.signal import qspline1d, qspline1d_eval
355
+ >>> rng = np.random.default_rng()
356
+ >>> sig = np.repeat([0., 1., 0.], 100)
357
+ >>> sig += rng.standard_normal(len(sig))*0.05 # add noise
358
+ >>> time = np.linspace(0, len(sig))
359
+ >>> filtered = qspline1d_eval(qspline1d(sig), time)
360
+ >>> plt.plot(sig, label="signal")
361
+ >>> plt.plot(time, filtered, label="filtered")
362
+ >>> plt.legend()
363
+ >>> plt.show()
364
+
365
+ """
366
+ if lamb != 0.0:
367
+ raise ValueError("Smoothing quadratic splines not supported yet.")
368
+ else:
369
+ return _quadratic_coeff(signal)
370
+
371
+
372
+ def cspline1d_eval(cj, newx, dx=1.0, x0=0):
373
+ """Evaluate a cubic spline at the new set of points.
374
+
375
+ `dx` is the old sample-spacing while `x0` was the old origin. In
376
+ other-words the old-sample points (knot-points) for which the `cj`
377
+ represent spline coefficients were at equally-spaced points of:
378
+
379
+ oldx = x0 + j*dx j=0...N-1, with N=len(cj)
380
+
381
+ Edges are handled using mirror-symmetric boundary conditions.
382
+
383
+ Parameters
384
+ ----------
385
+ cj : ndarray
386
+ cublic spline coefficients
387
+ newx : ndarray
388
+ New set of points.
389
+ dx : float, optional
390
+ Old sample-spacing, the default value is 1.0.
391
+ x0 : int, optional
392
+ Old origin, the default value is 0.
393
+
394
+ Returns
395
+ -------
396
+ res : ndarray
397
+ Evaluated a cubic spline points.
398
+
399
+ See Also
400
+ --------
401
+ cspline1d : Compute cubic spline coefficients for rank-1 array.
402
+
403
+ Examples
404
+ --------
405
+ We can filter a signal to reduce and smooth out high-frequency noise with
406
+ a cubic spline:
407
+
408
+ >>> import numpy as np
409
+ >>> import matplotlib.pyplot as plt
410
+ >>> from scipy.signal import cspline1d, cspline1d_eval
411
+ >>> rng = np.random.default_rng()
412
+ >>> sig = np.repeat([0., 1., 0.], 100)
413
+ >>> sig += rng.standard_normal(len(sig))*0.05 # add noise
414
+ >>> time = np.linspace(0, len(sig))
415
+ >>> filtered = cspline1d_eval(cspline1d(sig), time)
416
+ >>> plt.plot(sig, label="signal")
417
+ >>> plt.plot(time, filtered, label="filtered")
418
+ >>> plt.legend()
419
+ >>> plt.show()
420
+
421
+ """
422
+ newx = (asarray(newx) - x0) / float(dx)
423
+ res = zeros_like(newx, dtype=cj.dtype)
424
+ if res.size == 0:
425
+ return res
426
+ N = len(cj)
427
+ cond1 = newx < 0
428
+ cond2 = newx > (N - 1)
429
+ cond3 = ~(cond1 | cond2)
430
+ # handle general mirror-symmetry
431
+ res[cond1] = cspline1d_eval(cj, -newx[cond1])
432
+ res[cond2] = cspline1d_eval(cj, 2 * (N - 1) - newx[cond2])
433
+ newx = newx[cond3]
434
+ if newx.size == 0:
435
+ return res
436
+ result = zeros_like(newx, dtype=cj.dtype)
437
+ jlower = floor(newx - 2).astype(int) + 1
438
+ for i in range(4):
439
+ thisj = jlower + i
440
+ indj = thisj.clip(0, N - 1) # handle edge cases
441
+ result += cj[indj] * _cubic(newx - thisj)
442
+ res[cond3] = result
443
+ return res
444
+
445
+
446
+ def qspline1d_eval(cj, newx, dx=1.0, x0=0):
447
+ """Evaluate a quadratic spline at the new set of points.
448
+
449
+ Parameters
450
+ ----------
451
+ cj : ndarray
452
+ Quadratic spline coefficients
453
+ newx : ndarray
454
+ New set of points.
455
+ dx : float, optional
456
+ Old sample-spacing, the default value is 1.0.
457
+ x0 : int, optional
458
+ Old origin, the default value is 0.
459
+
460
+ Returns
461
+ -------
462
+ res : ndarray
463
+ Evaluated a quadratic spline points.
464
+
465
+ See Also
466
+ --------
467
+ qspline1d : Compute quadratic spline coefficients for rank-1 array.
468
+
469
+ Notes
470
+ -----
471
+ `dx` is the old sample-spacing while `x0` was the old origin. In
472
+ other-words the old-sample points (knot-points) for which the `cj`
473
+ represent spline coefficients were at equally-spaced points of::
474
+
475
+ oldx = x0 + j*dx j=0...N-1, with N=len(cj)
476
+
477
+ Edges are handled using mirror-symmetric boundary conditions.
478
+
479
+ Examples
480
+ --------
481
+ We can filter a signal to reduce and smooth out high-frequency noise with
482
+ a quadratic spline:
483
+
484
+ >>> import numpy as np
485
+ >>> import matplotlib.pyplot as plt
486
+ >>> from scipy.signal import qspline1d, qspline1d_eval
487
+ >>> rng = np.random.default_rng()
488
+ >>> sig = np.repeat([0., 1., 0.], 100)
489
+ >>> sig += rng.standard_normal(len(sig))*0.05 # add noise
490
+ >>> time = np.linspace(0, len(sig))
491
+ >>> filtered = qspline1d_eval(qspline1d(sig), time)
492
+ >>> plt.plot(sig, label="signal")
493
+ >>> plt.plot(time, filtered, label="filtered")
494
+ >>> plt.legend()
495
+ >>> plt.show()
496
+
497
+ """
498
+ newx = (asarray(newx) - x0) / dx
499
+ res = zeros_like(newx)
500
+ if res.size == 0:
501
+ return res
502
+ N = len(cj)
503
+ cond1 = newx < 0
504
+ cond2 = newx > (N - 1)
505
+ cond3 = ~(cond1 | cond2)
506
+ # handle general mirror-symmetry
507
+ res[cond1] = qspline1d_eval(cj, -newx[cond1])
508
+ res[cond2] = qspline1d_eval(cj, 2 * (N - 1) - newx[cond2])
509
+ newx = newx[cond3]
510
+ if newx.size == 0:
511
+ return res
512
+ result = zeros_like(newx)
513
+ jlower = floor(newx - 1.5).astype(int) + 1
514
+ for i in range(3):
515
+ thisj = jlower + i
516
+ indj = thisj.clip(0, N - 1) # handle edge cases
517
+ result += cj[indj] * _quadratic(newx - thisj)
518
+ res[cond3] = result
519
+ return res
parrot/lib/python3.10/site-packages/scipy/signal/_peak_finding.py ADDED
@@ -0,0 +1,1312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Functions for identifying peaks in signals.
3
+ """
4
+ import math
5
+ import numpy as np
6
+
7
+ from scipy.signal._wavelets import _cwt, _ricker
8
+ from scipy.stats import scoreatpercentile
9
+
10
+ from ._peak_finding_utils import (
11
+ _local_maxima_1d,
12
+ _select_by_peak_distance,
13
+ _peak_prominences,
14
+ _peak_widths
15
+ )
16
+
17
+
18
+ __all__ = ['argrelmin', 'argrelmax', 'argrelextrema', 'peak_prominences',
19
+ 'peak_widths', 'find_peaks', 'find_peaks_cwt']
20
+
21
+
22
+ def _boolrelextrema(data, comparator, axis=0, order=1, mode='clip'):
23
+ """
24
+ Calculate the relative extrema of `data`.
25
+
26
+ Relative extrema are calculated by finding locations where
27
+ ``comparator(data[n], data[n+1:n+order+1])`` is True.
28
+
29
+ Parameters
30
+ ----------
31
+ data : ndarray
32
+ Array in which to find the relative extrema.
33
+ comparator : callable
34
+ Function to use to compare two data points.
35
+ Should take two arrays as arguments.
36
+ axis : int, optional
37
+ Axis over which to select from `data`. Default is 0.
38
+ order : int, optional
39
+ How many points on each side to use for the comparison
40
+ to consider ``comparator(n,n+x)`` to be True.
41
+ mode : str, optional
42
+ How the edges of the vector are treated. 'wrap' (wrap around) or
43
+ 'clip' (treat overflow as the same as the last (or first) element).
44
+ Default 'clip'. See numpy.take.
45
+
46
+ Returns
47
+ -------
48
+ extrema : ndarray
49
+ Boolean array of the same shape as `data` that is True at an extrema,
50
+ False otherwise.
51
+
52
+ See also
53
+ --------
54
+ argrelmax, argrelmin
55
+
56
+ Examples
57
+ --------
58
+ >>> import numpy as np
59
+ >>> from scipy.signal._peak_finding import _boolrelextrema
60
+ >>> testdata = np.array([1,2,3,2,1])
61
+ >>> _boolrelextrema(testdata, np.greater, axis=0)
62
+ array([False, False, True, False, False], dtype=bool)
63
+
64
+ """
65
+ if (int(order) != order) or (order < 1):
66
+ raise ValueError('Order must be an int >= 1')
67
+
68
+ datalen = data.shape[axis]
69
+ locs = np.arange(0, datalen)
70
+
71
+ results = np.ones(data.shape, dtype=bool)
72
+ main = data.take(locs, axis=axis, mode=mode)
73
+ for shift in range(1, order + 1):
74
+ plus = data.take(locs + shift, axis=axis, mode=mode)
75
+ minus = data.take(locs - shift, axis=axis, mode=mode)
76
+ results &= comparator(main, plus)
77
+ results &= comparator(main, minus)
78
+ if ~results.any():
79
+ return results
80
+ return results
81
+
82
+
83
+ def argrelmin(data, axis=0, order=1, mode='clip'):
84
+ """
85
+ Calculate the relative minima of `data`.
86
+
87
+ Parameters
88
+ ----------
89
+ data : ndarray
90
+ Array in which to find the relative minima.
91
+ axis : int, optional
92
+ Axis over which to select from `data`. Default is 0.
93
+ order : int, optional
94
+ How many points on each side to use for the comparison
95
+ to consider ``comparator(n, n+x)`` to be True.
96
+ mode : str, optional
97
+ How the edges of the vector are treated.
98
+ Available options are 'wrap' (wrap around) or 'clip' (treat overflow
99
+ as the same as the last (or first) element).
100
+ Default 'clip'. See numpy.take.
101
+
102
+ Returns
103
+ -------
104
+ extrema : tuple of ndarrays
105
+ Indices of the minima in arrays of integers. ``extrema[k]`` is
106
+ the array of indices of axis `k` of `data`. Note that the
107
+ return value is a tuple even when `data` is 1-D.
108
+
109
+ See Also
110
+ --------
111
+ argrelextrema, argrelmax, find_peaks
112
+
113
+ Notes
114
+ -----
115
+ This function uses `argrelextrema` with np.less as comparator. Therefore, it
116
+ requires a strict inequality on both sides of a value to consider it a
117
+ minimum. This means flat minima (more than one sample wide) are not detected.
118
+ In case of 1-D `data` `find_peaks` can be used to detect all
119
+ local minima, including flat ones, by calling it with negated `data`.
120
+
121
+ .. versionadded:: 0.11.0
122
+
123
+ Examples
124
+ --------
125
+ >>> import numpy as np
126
+ >>> from scipy.signal import argrelmin
127
+ >>> x = np.array([2, 1, 2, 3, 2, 0, 1, 0])
128
+ >>> argrelmin(x)
129
+ (array([1, 5]),)
130
+ >>> y = np.array([[1, 2, 1, 2],
131
+ ... [2, 2, 0, 0],
132
+ ... [5, 3, 4, 4]])
133
+ ...
134
+ >>> argrelmin(y, axis=1)
135
+ (array([0, 2]), array([2, 1]))
136
+
137
+ """
138
+ return argrelextrema(data, np.less, axis, order, mode)
139
+
140
+
141
+ def argrelmax(data, axis=0, order=1, mode='clip'):
142
+ """
143
+ Calculate the relative maxima of `data`.
144
+
145
+ Parameters
146
+ ----------
147
+ data : ndarray
148
+ Array in which to find the relative maxima.
149
+ axis : int, optional
150
+ Axis over which to select from `data`. Default is 0.
151
+ order : int, optional
152
+ How many points on each side to use for the comparison
153
+ to consider ``comparator(n, n+x)`` to be True.
154
+ mode : str, optional
155
+ How the edges of the vector are treated.
156
+ Available options are 'wrap' (wrap around) or 'clip' (treat overflow
157
+ as the same as the last (or first) element).
158
+ Default 'clip'. See `numpy.take`.
159
+
160
+ Returns
161
+ -------
162
+ extrema : tuple of ndarrays
163
+ Indices of the maxima in arrays of integers. ``extrema[k]`` is
164
+ the array of indices of axis `k` of `data`. Note that the
165
+ return value is a tuple even when `data` is 1-D.
166
+
167
+ See Also
168
+ --------
169
+ argrelextrema, argrelmin, find_peaks
170
+
171
+ Notes
172
+ -----
173
+ This function uses `argrelextrema` with np.greater as comparator. Therefore,
174
+ it requires a strict inequality on both sides of a value to consider it a
175
+ maximum. This means flat maxima (more than one sample wide) are not detected.
176
+ In case of 1-D `data` `find_peaks` can be used to detect all
177
+ local maxima, including flat ones.
178
+
179
+ .. versionadded:: 0.11.0
180
+
181
+ Examples
182
+ --------
183
+ >>> import numpy as np
184
+ >>> from scipy.signal import argrelmax
185
+ >>> x = np.array([2, 1, 2, 3, 2, 0, 1, 0])
186
+ >>> argrelmax(x)
187
+ (array([3, 6]),)
188
+ >>> y = np.array([[1, 2, 1, 2],
189
+ ... [2, 2, 0, 0],
190
+ ... [5, 3, 4, 4]])
191
+ ...
192
+ >>> argrelmax(y, axis=1)
193
+ (array([0]), array([1]))
194
+ """
195
+ return argrelextrema(data, np.greater, axis, order, mode)
196
+
197
+
198
+ def argrelextrema(data, comparator, axis=0, order=1, mode='clip'):
199
+ """
200
+ Calculate the relative extrema of `data`.
201
+
202
+ Parameters
203
+ ----------
204
+ data : ndarray
205
+ Array in which to find the relative extrema.
206
+ comparator : callable
207
+ Function to use to compare two data points.
208
+ Should take two arrays as arguments.
209
+ axis : int, optional
210
+ Axis over which to select from `data`. Default is 0.
211
+ order : int, optional
212
+ How many points on each side to use for the comparison
213
+ to consider ``comparator(n, n+x)`` to be True.
214
+ mode : str, optional
215
+ How the edges of the vector are treated. 'wrap' (wrap around) or
216
+ 'clip' (treat overflow as the same as the last (or first) element).
217
+ Default is 'clip'. See `numpy.take`.
218
+
219
+ Returns
220
+ -------
221
+ extrema : tuple of ndarrays
222
+ Indices of the maxima in arrays of integers. ``extrema[k]`` is
223
+ the array of indices of axis `k` of `data`. Note that the
224
+ return value is a tuple even when `data` is 1-D.
225
+
226
+ See Also
227
+ --------
228
+ argrelmin, argrelmax
229
+
230
+ Notes
231
+ -----
232
+
233
+ .. versionadded:: 0.11.0
234
+
235
+ Examples
236
+ --------
237
+ >>> import numpy as np
238
+ >>> from scipy.signal import argrelextrema
239
+ >>> x = np.array([2, 1, 2, 3, 2, 0, 1, 0])
240
+ >>> argrelextrema(x, np.greater)
241
+ (array([3, 6]),)
242
+ >>> y = np.array([[1, 2, 1, 2],
243
+ ... [2, 2, 0, 0],
244
+ ... [5, 3, 4, 4]])
245
+ ...
246
+ >>> argrelextrema(y, np.less, axis=1)
247
+ (array([0, 2]), array([2, 1]))
248
+
249
+ """
250
+ results = _boolrelextrema(data, comparator,
251
+ axis, order, mode)
252
+ return np.nonzero(results)
253
+
254
+
255
+ def _arg_x_as_expected(value):
256
+ """Ensure argument `x` is a 1-D C-contiguous array of dtype('float64').
257
+
258
+ Used in `find_peaks`, `peak_prominences` and `peak_widths` to make `x`
259
+ compatible with the signature of the wrapped Cython functions.
260
+
261
+ Returns
262
+ -------
263
+ value : ndarray
264
+ A 1-D C-contiguous array with dtype('float64').
265
+ """
266
+ value = np.asarray(value, order='C', dtype=np.float64)
267
+ if value.ndim != 1:
268
+ raise ValueError('`x` must be a 1-D array')
269
+ return value
270
+
271
+
272
+ def _arg_peaks_as_expected(value):
273
+ """Ensure argument `peaks` is a 1-D C-contiguous array of dtype('intp').
274
+
275
+ Used in `peak_prominences` and `peak_widths` to make `peaks` compatible
276
+ with the signature of the wrapped Cython functions.
277
+
278
+ Returns
279
+ -------
280
+ value : ndarray
281
+ A 1-D C-contiguous array with dtype('intp').
282
+ """
283
+ value = np.asarray(value)
284
+ if value.size == 0:
285
+ # Empty arrays default to np.float64 but are valid input
286
+ value = np.array([], dtype=np.intp)
287
+ try:
288
+ # Safely convert to C-contiguous array of type np.intp
289
+ value = value.astype(np.intp, order='C', casting='safe',
290
+ subok=False, copy=False)
291
+ except TypeError as e:
292
+ raise TypeError("cannot safely cast `peaks` to dtype('intp')") from e
293
+ if value.ndim != 1:
294
+ raise ValueError('`peaks` must be a 1-D array')
295
+ return value
296
+
297
+
298
+ def _arg_wlen_as_expected(value):
299
+ """Ensure argument `wlen` is of type `np.intp` and larger than 1.
300
+
301
+ Used in `peak_prominences` and `peak_widths`.
302
+
303
+ Returns
304
+ -------
305
+ value : np.intp
306
+ The original `value` rounded up to an integer or -1 if `value` was
307
+ None.
308
+ """
309
+ if value is None:
310
+ # _peak_prominences expects an intp; -1 signals that no value was
311
+ # supplied by the user
312
+ value = -1
313
+ elif 1 < value:
314
+ # Round up to a positive integer
315
+ if isinstance(value, float):
316
+ value = math.ceil(value)
317
+ value = np.intp(value)
318
+ else:
319
+ raise ValueError(f'`wlen` must be larger than 1, was {value}')
320
+ return value
321
+
322
+
323
+ def peak_prominences(x, peaks, wlen=None):
324
+ """
325
+ Calculate the prominence of each peak in a signal.
326
+
327
+ The prominence of a peak measures how much a peak stands out from the
328
+ surrounding baseline of the signal and is defined as the vertical distance
329
+ between the peak and its lowest contour line.
330
+
331
+ Parameters
332
+ ----------
333
+ x : sequence
334
+ A signal with peaks.
335
+ peaks : sequence
336
+ Indices of peaks in `x`.
337
+ wlen : int, optional
338
+ A window length in samples that optionally limits the evaluated area for
339
+ each peak to a subset of `x`. The peak is always placed in the middle of
340
+ the window therefore the given length is rounded up to the next odd
341
+ integer. This parameter can speed up the calculation (see Notes).
342
+
343
+ Returns
344
+ -------
345
+ prominences : ndarray
346
+ The calculated prominences for each peak in `peaks`.
347
+ left_bases, right_bases : ndarray
348
+ The peaks' bases as indices in `x` to the left and right of each peak.
349
+ The higher base of each pair is a peak's lowest contour line.
350
+
351
+ Raises
352
+ ------
353
+ ValueError
354
+ If a value in `peaks` is an invalid index for `x`.
355
+
356
+ Warns
357
+ -----
358
+ PeakPropertyWarning
359
+ For indices in `peaks` that don't point to valid local maxima in `x`,
360
+ the returned prominence will be 0 and this warning is raised. This
361
+ also happens if `wlen` is smaller than the plateau size of a peak.
362
+
363
+ Warnings
364
+ --------
365
+ This function may return unexpected results for data containing NaNs. To
366
+ avoid this, NaNs should either be removed or replaced.
367
+
368
+ See Also
369
+ --------
370
+ find_peaks
371
+ Find peaks inside a signal based on peak properties.
372
+ peak_widths
373
+ Calculate the width of peaks.
374
+
375
+ Notes
376
+ -----
377
+ Strategy to compute a peak's prominence:
378
+
379
+ 1. Extend a horizontal line from the current peak to the left and right
380
+ until the line either reaches the window border (see `wlen`) or
381
+ intersects the signal again at the slope of a higher peak. An
382
+ intersection with a peak of the same height is ignored.
383
+ 2. On each side find the minimal signal value within the interval defined
384
+ above. These points are the peak's bases.
385
+ 3. The higher one of the two bases marks the peak's lowest contour line. The
386
+ prominence can then be calculated as the vertical difference between the
387
+ peaks height itself and its lowest contour line.
388
+
389
+ Searching for the peak's bases can be slow for large `x` with periodic
390
+ behavior because large chunks or even the full signal need to be evaluated
391
+ for the first algorithmic step. This evaluation area can be limited with the
392
+ parameter `wlen` which restricts the algorithm to a window around the
393
+ current peak and can shorten the calculation time if the window length is
394
+ short in relation to `x`.
395
+ However, this may stop the algorithm from finding the true global contour
396
+ line if the peak's true bases are outside this window. Instead, a higher
397
+ contour line is found within the restricted window leading to a smaller
398
+ calculated prominence. In practice, this is only relevant for the highest set
399
+ of peaks in `x`. This behavior may even be used intentionally to calculate
400
+ "local" prominences.
401
+
402
+ .. versionadded:: 1.1.0
403
+
404
+ References
405
+ ----------
406
+ .. [1] Wikipedia Article for Topographic Prominence:
407
+ https://en.wikipedia.org/wiki/Topographic_prominence
408
+
409
+ Examples
410
+ --------
411
+ >>> import numpy as np
412
+ >>> from scipy.signal import find_peaks, peak_prominences
413
+ >>> import matplotlib.pyplot as plt
414
+
415
+ Create a test signal with two overlaid harmonics
416
+
417
+ >>> x = np.linspace(0, 6 * np.pi, 1000)
418
+ >>> x = np.sin(x) + 0.6 * np.sin(2.6 * x)
419
+
420
+ Find all peaks and calculate prominences
421
+
422
+ >>> peaks, _ = find_peaks(x)
423
+ >>> prominences = peak_prominences(x, peaks)[0]
424
+ >>> prominences
425
+ array([1.24159486, 0.47840168, 0.28470524, 3.10716793, 0.284603 ,
426
+ 0.47822491, 2.48340261, 0.47822491])
427
+
428
+ Calculate the height of each peak's contour line and plot the results
429
+
430
+ >>> contour_heights = x[peaks] - prominences
431
+ >>> plt.plot(x)
432
+ >>> plt.plot(peaks, x[peaks], "x")
433
+ >>> plt.vlines(x=peaks, ymin=contour_heights, ymax=x[peaks])
434
+ >>> plt.show()
435
+
436
+ Let's evaluate a second example that demonstrates several edge cases for
437
+ one peak at index 5.
438
+
439
+ >>> x = np.array([0, 1, 0, 3, 1, 3, 0, 4, 0])
440
+ >>> peaks = np.array([5])
441
+ >>> plt.plot(x)
442
+ >>> plt.plot(peaks, x[peaks], "x")
443
+ >>> plt.show()
444
+ >>> peak_prominences(x, peaks) # -> (prominences, left_bases, right_bases)
445
+ (array([3.]), array([2]), array([6]))
446
+
447
+ Note how the peak at index 3 of the same height is not considered as a
448
+ border while searching for the left base. Instead, two minima at 0 and 2
449
+ are found in which case the one closer to the evaluated peak is always
450
+ chosen. On the right side, however, the base must be placed at 6 because the
451
+ higher peak represents the right border to the evaluated area.
452
+
453
+ >>> peak_prominences(x, peaks, wlen=3.1)
454
+ (array([2.]), array([4]), array([6]))
455
+
456
+ Here, we restricted the algorithm to a window from 3 to 7 (the length is 5
457
+ samples because `wlen` was rounded up to the next odd integer). Thus, the
458
+ only two candidates in the evaluated area are the two neighboring samples
459
+ and a smaller prominence is calculated.
460
+ """
461
+ x = _arg_x_as_expected(x)
462
+ peaks = _arg_peaks_as_expected(peaks)
463
+ wlen = _arg_wlen_as_expected(wlen)
464
+ return _peak_prominences(x, peaks, wlen)
465
+
466
+
467
+ def peak_widths(x, peaks, rel_height=0.5, prominence_data=None, wlen=None):
468
+ """
469
+ Calculate the width of each peak in a signal.
470
+
471
+ This function calculates the width of a peak in samples at a relative
472
+ distance to the peak's height and prominence.
473
+
474
+ Parameters
475
+ ----------
476
+ x : sequence
477
+ A signal with peaks.
478
+ peaks : sequence
479
+ Indices of peaks in `x`.
480
+ rel_height : float, optional
481
+ Chooses the relative height at which the peak width is measured as a
482
+ percentage of its prominence. 1.0 calculates the width of the peak at
483
+ its lowest contour line while 0.5 evaluates at half the prominence
484
+ height. Must be at least 0. See notes for further explanation.
485
+ prominence_data : tuple, optional
486
+ A tuple of three arrays matching the output of `peak_prominences` when
487
+ called with the same arguments `x` and `peaks`. This data are calculated
488
+ internally if not provided.
489
+ wlen : int, optional
490
+ A window length in samples passed to `peak_prominences` as an optional
491
+ argument for internal calculation of `prominence_data`. This argument
492
+ is ignored if `prominence_data` is given.
493
+
494
+ Returns
495
+ -------
496
+ widths : ndarray
497
+ The widths for each peak in samples.
498
+ width_heights : ndarray
499
+ The height of the contour lines at which the `widths` where evaluated.
500
+ left_ips, right_ips : ndarray
501
+ Interpolated positions of left and right intersection points of a
502
+ horizontal line at the respective evaluation height.
503
+
504
+ Raises
505
+ ------
506
+ ValueError
507
+ If `prominence_data` is supplied but doesn't satisfy the condition
508
+ ``0 <= left_base <= peak <= right_base < x.shape[0]`` for each peak,
509
+ has the wrong dtype, is not C-contiguous or does not have the same
510
+ shape.
511
+
512
+ Warns
513
+ -----
514
+ PeakPropertyWarning
515
+ Raised if any calculated width is 0. This may stem from the supplied
516
+ `prominence_data` or if `rel_height` is set to 0.
517
+
518
+ Warnings
519
+ --------
520
+ This function may return unexpected results for data containing NaNs. To
521
+ avoid this, NaNs should either be removed or replaced.
522
+
523
+ See Also
524
+ --------
525
+ find_peaks
526
+ Find peaks inside a signal based on peak properties.
527
+ peak_prominences
528
+ Calculate the prominence of peaks.
529
+
530
+ Notes
531
+ -----
532
+ The basic algorithm to calculate a peak's width is as follows:
533
+
534
+ * Calculate the evaluation height :math:`h_{eval}` with the formula
535
+ :math:`h_{eval} = h_{Peak} - P \\cdot R`, where :math:`h_{Peak}` is the
536
+ height of the peak itself, :math:`P` is the peak's prominence and
537
+ :math:`R` a positive ratio specified with the argument `rel_height`.
538
+ * Draw a horizontal line at the evaluation height to both sides, starting at
539
+ the peak's current vertical position until the lines either intersect a
540
+ slope, the signal border or cross the vertical position of the peak's
541
+ base (see `peak_prominences` for an definition). For the first case,
542
+ intersection with the signal, the true intersection point is estimated
543
+ with linear interpolation.
544
+ * Calculate the width as the horizontal distance between the chosen
545
+ endpoints on both sides. As a consequence of this the maximal possible
546
+ width for each peak is the horizontal distance between its bases.
547
+
548
+ As shown above to calculate a peak's width its prominence and bases must be
549
+ known. You can supply these yourself with the argument `prominence_data`.
550
+ Otherwise, they are internally calculated (see `peak_prominences`).
551
+
552
+ .. versionadded:: 1.1.0
553
+
554
+ Examples
555
+ --------
556
+ >>> import numpy as np
557
+ >>> from scipy.signal import chirp, find_peaks, peak_widths
558
+ >>> import matplotlib.pyplot as plt
559
+
560
+ Create a test signal with two overlaid harmonics
561
+
562
+ >>> x = np.linspace(0, 6 * np.pi, 1000)
563
+ >>> x = np.sin(x) + 0.6 * np.sin(2.6 * x)
564
+
565
+ Find all peaks and calculate their widths at the relative height of 0.5
566
+ (contour line at half the prominence height) and 1 (at the lowest contour
567
+ line at full prominence height).
568
+
569
+ >>> peaks, _ = find_peaks(x)
570
+ >>> results_half = peak_widths(x, peaks, rel_height=0.5)
571
+ >>> results_half[0] # widths
572
+ array([ 64.25172825, 41.29465463, 35.46943289, 104.71586081,
573
+ 35.46729324, 41.30429622, 181.93835853, 45.37078546])
574
+ >>> results_full = peak_widths(x, peaks, rel_height=1)
575
+ >>> results_full[0] # widths
576
+ array([181.9396084 , 72.99284945, 61.28657872, 373.84622694,
577
+ 61.78404617, 72.48822812, 253.09161876, 79.36860878])
578
+
579
+ Plot signal, peaks and contour lines at which the widths where calculated
580
+
581
+ >>> plt.plot(x)
582
+ >>> plt.plot(peaks, x[peaks], "x")
583
+ >>> plt.hlines(*results_half[1:], color="C2")
584
+ >>> plt.hlines(*results_full[1:], color="C3")
585
+ >>> plt.show()
586
+ """
587
+ x = _arg_x_as_expected(x)
588
+ peaks = _arg_peaks_as_expected(peaks)
589
+ if prominence_data is None:
590
+ # Calculate prominence if not supplied and use wlen if supplied.
591
+ wlen = _arg_wlen_as_expected(wlen)
592
+ prominence_data = _peak_prominences(x, peaks, wlen)
593
+ return _peak_widths(x, peaks, rel_height, *prominence_data)
594
+
595
+
596
+ def _unpack_condition_args(interval, x, peaks):
597
+ """
598
+ Parse condition arguments for `find_peaks`.
599
+
600
+ Parameters
601
+ ----------
602
+ interval : number or ndarray or sequence
603
+ Either a number or ndarray or a 2-element sequence of the former. The
604
+ first value is always interpreted as `imin` and the second, if supplied,
605
+ as `imax`.
606
+ x : ndarray
607
+ The signal with `peaks`.
608
+ peaks : ndarray
609
+ An array with indices used to reduce `imin` and / or `imax` if those are
610
+ arrays.
611
+
612
+ Returns
613
+ -------
614
+ imin, imax : number or ndarray or None
615
+ Minimal and maximal value in `argument`.
616
+
617
+ Raises
618
+ ------
619
+ ValueError :
620
+ If interval border is given as array and its size does not match the size
621
+ of `x`.
622
+
623
+ Notes
624
+ -----
625
+
626
+ .. versionadded:: 1.1.0
627
+ """
628
+ try:
629
+ imin, imax = interval
630
+ except (TypeError, ValueError):
631
+ imin, imax = (interval, None)
632
+
633
+ # Reduce arrays if arrays
634
+ if isinstance(imin, np.ndarray):
635
+ if imin.size != x.size:
636
+ raise ValueError('array size of lower interval border must match x')
637
+ imin = imin[peaks]
638
+ if isinstance(imax, np.ndarray):
639
+ if imax.size != x.size:
640
+ raise ValueError('array size of upper interval border must match x')
641
+ imax = imax[peaks]
642
+
643
+ return imin, imax
644
+
645
+
646
+ def _select_by_property(peak_properties, pmin, pmax):
647
+ """
648
+ Evaluate where the generic property of peaks confirms to an interval.
649
+
650
+ Parameters
651
+ ----------
652
+ peak_properties : ndarray
653
+ An array with properties for each peak.
654
+ pmin : None or number or ndarray
655
+ Lower interval boundary for `peak_properties`. ``None`` is interpreted as
656
+ an open border.
657
+ pmax : None or number or ndarray
658
+ Upper interval boundary for `peak_properties`. ``None`` is interpreted as
659
+ an open border.
660
+
661
+ Returns
662
+ -------
663
+ keep : bool
664
+ A boolean mask evaluating to true where `peak_properties` confirms to the
665
+ interval.
666
+
667
+ See Also
668
+ --------
669
+ find_peaks
670
+
671
+ Notes
672
+ -----
673
+
674
+ .. versionadded:: 1.1.0
675
+ """
676
+ keep = np.ones(peak_properties.size, dtype=bool)
677
+ if pmin is not None:
678
+ keep &= (pmin <= peak_properties)
679
+ if pmax is not None:
680
+ keep &= (peak_properties <= pmax)
681
+ return keep
682
+
683
+
684
+ def _select_by_peak_threshold(x, peaks, tmin, tmax):
685
+ """
686
+ Evaluate which peaks fulfill the threshold condition.
687
+
688
+ Parameters
689
+ ----------
690
+ x : ndarray
691
+ A 1-D array which is indexable by `peaks`.
692
+ peaks : ndarray
693
+ Indices of peaks in `x`.
694
+ tmin, tmax : scalar or ndarray or None
695
+ Minimal and / or maximal required thresholds. If supplied as ndarrays
696
+ their size must match `peaks`. ``None`` is interpreted as an open
697
+ border.
698
+
699
+ Returns
700
+ -------
701
+ keep : bool
702
+ A boolean mask evaluating to true where `peaks` fulfill the threshold
703
+ condition.
704
+ left_thresholds, right_thresholds : ndarray
705
+ Array matching `peak` containing the thresholds of each peak on
706
+ both sides.
707
+
708
+ Notes
709
+ -----
710
+
711
+ .. versionadded:: 1.1.0
712
+ """
713
+ # Stack thresholds on both sides to make min / max operations easier:
714
+ # tmin is compared with the smaller, and tmax with the greater threshold to
715
+ # each peak's side
716
+ stacked_thresholds = np.vstack([x[peaks] - x[peaks - 1],
717
+ x[peaks] - x[peaks + 1]])
718
+ keep = np.ones(peaks.size, dtype=bool)
719
+ if tmin is not None:
720
+ min_thresholds = np.min(stacked_thresholds, axis=0)
721
+ keep &= (tmin <= min_thresholds)
722
+ if tmax is not None:
723
+ max_thresholds = np.max(stacked_thresholds, axis=0)
724
+ keep &= (max_thresholds <= tmax)
725
+
726
+ return keep, stacked_thresholds[0], stacked_thresholds[1]
727
+
728
+
729
+ def find_peaks(x, height=None, threshold=None, distance=None,
730
+ prominence=None, width=None, wlen=None, rel_height=0.5,
731
+ plateau_size=None):
732
+ """
733
+ Find peaks inside a signal based on peak properties.
734
+
735
+ This function takes a 1-D array and finds all local maxima by
736
+ simple comparison of neighboring values. Optionally, a subset of these
737
+ peaks can be selected by specifying conditions for a peak's properties.
738
+
739
+ Parameters
740
+ ----------
741
+ x : sequence
742
+ A signal with peaks.
743
+ height : number or ndarray or sequence, optional
744
+ Required height of peaks. Either a number, ``None``, an array matching
745
+ `x` or a 2-element sequence of the former. The first element is
746
+ always interpreted as the minimal and the second, if supplied, as the
747
+ maximal required height.
748
+ threshold : number or ndarray or sequence, optional
749
+ Required threshold of peaks, the vertical distance to its neighboring
750
+ samples. Either a number, ``None``, an array matching `x` or a
751
+ 2-element sequence of the former. The first element is always
752
+ interpreted as the minimal and the second, if supplied, as the maximal
753
+ required threshold.
754
+ distance : number, optional
755
+ Required minimal horizontal distance (>= 1) in samples between
756
+ neighbouring peaks. Smaller peaks are removed first until the condition
757
+ is fulfilled for all remaining peaks.
758
+ prominence : number or ndarray or sequence, optional
759
+ Required prominence of peaks. Either a number, ``None``, an array
760
+ matching `x` or a 2-element sequence of the former. The first
761
+ element is always interpreted as the minimal and the second, if
762
+ supplied, as the maximal required prominence.
763
+ width : number or ndarray or sequence, optional
764
+ Required width of peaks in samples. Either a number, ``None``, an array
765
+ matching `x` or a 2-element sequence of the former. The first
766
+ element is always interpreted as the minimal and the second, if
767
+ supplied, as the maximal required width.
768
+ wlen : int, optional
769
+ Used for calculation of the peaks prominences, thus it is only used if
770
+ one of the arguments `prominence` or `width` is given. See argument
771
+ `wlen` in `peak_prominences` for a full description of its effects.
772
+ rel_height : float, optional
773
+ Used for calculation of the peaks width, thus it is only used if `width`
774
+ is given. See argument `rel_height` in `peak_widths` for a full
775
+ description of its effects.
776
+ plateau_size : number or ndarray or sequence, optional
777
+ Required size of the flat top of peaks in samples. Either a number,
778
+ ``None``, an array matching `x` or a 2-element sequence of the former.
779
+ The first element is always interpreted as the minimal and the second,
780
+ if supplied as the maximal required plateau size.
781
+
782
+ .. versionadded:: 1.2.0
783
+
784
+ Returns
785
+ -------
786
+ peaks : ndarray
787
+ Indices of peaks in `x` that satisfy all given conditions.
788
+ properties : dict
789
+ A dictionary containing properties of the returned peaks which were
790
+ calculated as intermediate results during evaluation of the specified
791
+ conditions:
792
+
793
+ * 'peak_heights'
794
+ If `height` is given, the height of each peak in `x`.
795
+ * 'left_thresholds', 'right_thresholds'
796
+ If `threshold` is given, these keys contain a peaks vertical
797
+ distance to its neighbouring samples.
798
+ * 'prominences', 'right_bases', 'left_bases'
799
+ If `prominence` is given, these keys are accessible. See
800
+ `peak_prominences` for a description of their content.
801
+ * 'width_heights', 'left_ips', 'right_ips'
802
+ If `width` is given, these keys are accessible. See `peak_widths`
803
+ for a description of their content.
804
+ * 'plateau_sizes', left_edges', 'right_edges'
805
+ If `plateau_size` is given, these keys are accessible and contain
806
+ the indices of a peak's edges (edges are still part of the
807
+ plateau) and the calculated plateau sizes.
808
+
809
+ .. versionadded:: 1.2.0
810
+
811
+ To calculate and return properties without excluding peaks, provide the
812
+ open interval ``(None, None)`` as a value to the appropriate argument
813
+ (excluding `distance`).
814
+
815
+ Warns
816
+ -----
817
+ PeakPropertyWarning
818
+ Raised if a peak's properties have unexpected values (see
819
+ `peak_prominences` and `peak_widths`).
820
+
821
+ Warnings
822
+ --------
823
+ This function may return unexpected results for data containing NaNs. To
824
+ avoid this, NaNs should either be removed or replaced.
825
+
826
+ See Also
827
+ --------
828
+ find_peaks_cwt
829
+ Find peaks using the wavelet transformation.
830
+ peak_prominences
831
+ Directly calculate the prominence of peaks.
832
+ peak_widths
833
+ Directly calculate the width of peaks.
834
+
835
+ Notes
836
+ -----
837
+ In the context of this function, a peak or local maximum is defined as any
838
+ sample whose two direct neighbours have a smaller amplitude. For flat peaks
839
+ (more than one sample of equal amplitude wide) the index of the middle
840
+ sample is returned (rounded down in case the number of samples is even).
841
+ For noisy signals the peak locations can be off because the noise might
842
+ change the position of local maxima. In those cases consider smoothing the
843
+ signal before searching for peaks or use other peak finding and fitting
844
+ methods (like `find_peaks_cwt`).
845
+
846
+ Some additional comments on specifying conditions:
847
+
848
+ * Almost all conditions (excluding `distance`) can be given as half-open or
849
+ closed intervals, e.g., ``1`` or ``(1, None)`` defines the half-open
850
+ interval :math:`[1, \\infty]` while ``(None, 1)`` defines the interval
851
+ :math:`[-\\infty, 1]`. The open interval ``(None, None)`` can be specified
852
+ as well, which returns the matching properties without exclusion of peaks.
853
+ * The border is always included in the interval used to select valid peaks.
854
+ * For several conditions the interval borders can be specified with
855
+ arrays matching `x` in shape which enables dynamic constrains based on
856
+ the sample position.
857
+ * The conditions are evaluated in the following order: `plateau_size`,
858
+ `height`, `threshold`, `distance`, `prominence`, `width`. In most cases
859
+ this order is the fastest one because faster operations are applied first
860
+ to reduce the number of peaks that need to be evaluated later.
861
+ * While indices in `peaks` are guaranteed to be at least `distance` samples
862
+ apart, edges of flat peaks may be closer than the allowed `distance`.
863
+ * Use `wlen` to reduce the time it takes to evaluate the conditions for
864
+ `prominence` or `width` if `x` is large or has many local maxima
865
+ (see `peak_prominences`).
866
+
867
+ .. versionadded:: 1.1.0
868
+
869
+ Examples
870
+ --------
871
+ To demonstrate this function's usage we use a signal `x` supplied with
872
+ SciPy (see `scipy.datasets.electrocardiogram`). Let's find all peaks (local
873
+ maxima) in `x` whose amplitude lies above 0.
874
+
875
+ >>> import numpy as np
876
+ >>> import matplotlib.pyplot as plt
877
+ >>> from scipy.datasets import electrocardiogram
878
+ >>> from scipy.signal import find_peaks
879
+ >>> x = electrocardiogram()[2000:4000]
880
+ >>> peaks, _ = find_peaks(x, height=0)
881
+ >>> plt.plot(x)
882
+ >>> plt.plot(peaks, x[peaks], "x")
883
+ >>> plt.plot(np.zeros_like(x), "--", color="gray")
884
+ >>> plt.show()
885
+
886
+ We can select peaks below 0 with ``height=(None, 0)`` or use arrays matching
887
+ `x` in size to reflect a changing condition for different parts of the
888
+ signal.
889
+
890
+ >>> border = np.sin(np.linspace(0, 3 * np.pi, x.size))
891
+ >>> peaks, _ = find_peaks(x, height=(-border, border))
892
+ >>> plt.plot(x)
893
+ >>> plt.plot(-border, "--", color="gray")
894
+ >>> plt.plot(border, ":", color="gray")
895
+ >>> plt.plot(peaks, x[peaks], "x")
896
+ >>> plt.show()
897
+
898
+ Another useful condition for periodic signals can be given with the
899
+ `distance` argument. In this case, we can easily select the positions of
900
+ QRS complexes within the electrocardiogram (ECG) by demanding a distance of
901
+ at least 150 samples.
902
+
903
+ >>> peaks, _ = find_peaks(x, distance=150)
904
+ >>> np.diff(peaks)
905
+ array([186, 180, 177, 171, 177, 169, 167, 164, 158, 162, 172])
906
+ >>> plt.plot(x)
907
+ >>> plt.plot(peaks, x[peaks], "x")
908
+ >>> plt.show()
909
+
910
+ Especially for noisy signals peaks can be easily grouped by their
911
+ prominence (see `peak_prominences`). E.g., we can select all peaks except
912
+ for the mentioned QRS complexes by limiting the allowed prominence to 0.6.
913
+
914
+ >>> peaks, properties = find_peaks(x, prominence=(None, 0.6))
915
+ >>> properties["prominences"].max()
916
+ 0.5049999999999999
917
+ >>> plt.plot(x)
918
+ >>> plt.plot(peaks, x[peaks], "x")
919
+ >>> plt.show()
920
+
921
+ And, finally, let's examine a different section of the ECG which contains
922
+ beat forms of different shape. To select only the atypical heart beats, we
923
+ combine two conditions: a minimal prominence of 1 and width of at least 20
924
+ samples.
925
+
926
+ >>> x = electrocardiogram()[17000:18000]
927
+ >>> peaks, properties = find_peaks(x, prominence=1, width=20)
928
+ >>> properties["prominences"], properties["widths"]
929
+ (array([1.495, 2.3 ]), array([36.93773946, 39.32723577]))
930
+ >>> plt.plot(x)
931
+ >>> plt.plot(peaks, x[peaks], "x")
932
+ >>> plt.vlines(x=peaks, ymin=x[peaks] - properties["prominences"],
933
+ ... ymax = x[peaks], color = "C1")
934
+ >>> plt.hlines(y=properties["width_heights"], xmin=properties["left_ips"],
935
+ ... xmax=properties["right_ips"], color = "C1")
936
+ >>> plt.show()
937
+ """
938
+ # _argmaxima1d expects array of dtype 'float64'
939
+ x = _arg_x_as_expected(x)
940
+ if distance is not None and distance < 1:
941
+ raise ValueError('`distance` must be greater or equal to 1')
942
+
943
+ peaks, left_edges, right_edges = _local_maxima_1d(x)
944
+ properties = {}
945
+
946
+ if plateau_size is not None:
947
+ # Evaluate plateau size
948
+ plateau_sizes = right_edges - left_edges + 1
949
+ pmin, pmax = _unpack_condition_args(plateau_size, x, peaks)
950
+ keep = _select_by_property(plateau_sizes, pmin, pmax)
951
+ peaks = peaks[keep]
952
+ properties["plateau_sizes"] = plateau_sizes
953
+ properties["left_edges"] = left_edges
954
+ properties["right_edges"] = right_edges
955
+ properties = {key: array[keep] for key, array in properties.items()}
956
+
957
+ if height is not None:
958
+ # Evaluate height condition
959
+ peak_heights = x[peaks]
960
+ hmin, hmax = _unpack_condition_args(height, x, peaks)
961
+ keep = _select_by_property(peak_heights, hmin, hmax)
962
+ peaks = peaks[keep]
963
+ properties["peak_heights"] = peak_heights
964
+ properties = {key: array[keep] for key, array in properties.items()}
965
+
966
+ if threshold is not None:
967
+ # Evaluate threshold condition
968
+ tmin, tmax = _unpack_condition_args(threshold, x, peaks)
969
+ keep, left_thresholds, right_thresholds = _select_by_peak_threshold(
970
+ x, peaks, tmin, tmax)
971
+ peaks = peaks[keep]
972
+ properties["left_thresholds"] = left_thresholds
973
+ properties["right_thresholds"] = right_thresholds
974
+ properties = {key: array[keep] for key, array in properties.items()}
975
+
976
+ if distance is not None:
977
+ # Evaluate distance condition
978
+ keep = _select_by_peak_distance(peaks, x[peaks], distance)
979
+ peaks = peaks[keep]
980
+ properties = {key: array[keep] for key, array in properties.items()}
981
+
982
+ if prominence is not None or width is not None:
983
+ # Calculate prominence (required for both conditions)
984
+ wlen = _arg_wlen_as_expected(wlen)
985
+ properties.update(zip(
986
+ ['prominences', 'left_bases', 'right_bases'],
987
+ _peak_prominences(x, peaks, wlen=wlen)
988
+ ))
989
+
990
+ if prominence is not None:
991
+ # Evaluate prominence condition
992
+ pmin, pmax = _unpack_condition_args(prominence, x, peaks)
993
+ keep = _select_by_property(properties['prominences'], pmin, pmax)
994
+ peaks = peaks[keep]
995
+ properties = {key: array[keep] for key, array in properties.items()}
996
+
997
+ if width is not None:
998
+ # Calculate widths
999
+ properties.update(zip(
1000
+ ['widths', 'width_heights', 'left_ips', 'right_ips'],
1001
+ _peak_widths(x, peaks, rel_height, properties['prominences'],
1002
+ properties['left_bases'], properties['right_bases'])
1003
+ ))
1004
+ # Evaluate width condition
1005
+ wmin, wmax = _unpack_condition_args(width, x, peaks)
1006
+ keep = _select_by_property(properties['widths'], wmin, wmax)
1007
+ peaks = peaks[keep]
1008
+ properties = {key: array[keep] for key, array in properties.items()}
1009
+
1010
+ return peaks, properties
1011
+
1012
+
1013
+ def _identify_ridge_lines(matr, max_distances, gap_thresh):
1014
+ """
1015
+ Identify ridges in the 2-D matrix.
1016
+
1017
+ Expect that the width of the wavelet feature increases with increasing row
1018
+ number.
1019
+
1020
+ Parameters
1021
+ ----------
1022
+ matr : 2-D ndarray
1023
+ Matrix in which to identify ridge lines.
1024
+ max_distances : 1-D sequence
1025
+ At each row, a ridge line is only connected
1026
+ if the relative max at row[n] is within
1027
+ `max_distances`[n] from the relative max at row[n+1].
1028
+ gap_thresh : int
1029
+ If a relative maximum is not found within `max_distances`,
1030
+ there will be a gap. A ridge line is discontinued if
1031
+ there are more than `gap_thresh` points without connecting
1032
+ a new relative maximum.
1033
+
1034
+ Returns
1035
+ -------
1036
+ ridge_lines : tuple
1037
+ Tuple of 2 1-D sequences. `ridge_lines`[ii][0] are the rows of the
1038
+ ii-th ridge-line, `ridge_lines`[ii][1] are the columns. Empty if none
1039
+ found. Each ridge-line will be sorted by row (increasing), but the
1040
+ order of the ridge lines is not specified.
1041
+
1042
+ References
1043
+ ----------
1044
+ .. [1] Bioinformatics (2006) 22 (17): 2059-2065.
1045
+ :doi:`10.1093/bioinformatics/btl355`
1046
+
1047
+ Examples
1048
+ --------
1049
+ >>> import numpy as np
1050
+ >>> from scipy.signal._peak_finding import _identify_ridge_lines
1051
+ >>> rng = np.random.default_rng()
1052
+ >>> data = rng.random((5,5))
1053
+ >>> max_dist = 3
1054
+ >>> max_distances = np.full(20, max_dist)
1055
+ >>> ridge_lines = _identify_ridge_lines(data, max_distances, 1)
1056
+
1057
+ Notes
1058
+ -----
1059
+ This function is intended to be used in conjunction with `cwt`
1060
+ as part of `find_peaks_cwt`.
1061
+
1062
+ """
1063
+ if len(max_distances) < matr.shape[0]:
1064
+ raise ValueError('Max_distances must have at least as many rows '
1065
+ 'as matr')
1066
+
1067
+ all_max_cols = _boolrelextrema(matr, np.greater, axis=1, order=1)
1068
+ # Highest row for which there are any relative maxima
1069
+ has_relmax = np.nonzero(all_max_cols.any(axis=1))[0]
1070
+ if len(has_relmax) == 0:
1071
+ return []
1072
+ start_row = has_relmax[-1]
1073
+ # Each ridge line is a 3-tuple:
1074
+ # rows, cols,Gap number
1075
+ ridge_lines = [[[start_row],
1076
+ [col],
1077
+ 0] for col in np.nonzero(all_max_cols[start_row])[0]]
1078
+ final_lines = []
1079
+ rows = np.arange(start_row - 1, -1, -1)
1080
+ cols = np.arange(0, matr.shape[1])
1081
+ for row in rows:
1082
+ this_max_cols = cols[all_max_cols[row]]
1083
+
1084
+ # Increment gap number of each line,
1085
+ # set it to zero later if appropriate
1086
+ for line in ridge_lines:
1087
+ line[2] += 1
1088
+
1089
+ # XXX These should always be all_max_cols[row]
1090
+ # But the order might be different. Might be an efficiency gain
1091
+ # to make sure the order is the same and avoid this iteration
1092
+ prev_ridge_cols = np.array([line[1][-1] for line in ridge_lines])
1093
+ # Look through every relative maximum found at current row
1094
+ # Attempt to connect them with existing ridge lines.
1095
+ for ind, col in enumerate(this_max_cols):
1096
+ # If there is a previous ridge line within
1097
+ # the max_distance to connect to, do so.
1098
+ # Otherwise start a new one.
1099
+ line = None
1100
+ if len(prev_ridge_cols) > 0:
1101
+ diffs = np.abs(col - prev_ridge_cols)
1102
+ closest = np.argmin(diffs)
1103
+ if diffs[closest] <= max_distances[row]:
1104
+ line = ridge_lines[closest]
1105
+ if line is not None:
1106
+ # Found a point close enough, extend current ridge line
1107
+ line[1].append(col)
1108
+ line[0].append(row)
1109
+ line[2] = 0
1110
+ else:
1111
+ new_line = [[row],
1112
+ [col],
1113
+ 0]
1114
+ ridge_lines.append(new_line)
1115
+
1116
+ # Remove the ridge lines with gap_number too high
1117
+ # XXX Modifying a list while iterating over it.
1118
+ # Should be safe, since we iterate backwards, but
1119
+ # still tacky.
1120
+ for ind in range(len(ridge_lines) - 1, -1, -1):
1121
+ line = ridge_lines[ind]
1122
+ if line[2] > gap_thresh:
1123
+ final_lines.append(line)
1124
+ del ridge_lines[ind]
1125
+
1126
+ out_lines = []
1127
+ for line in (final_lines + ridge_lines):
1128
+ sortargs = np.array(np.argsort(line[0]))
1129
+ rows, cols = np.zeros_like(sortargs), np.zeros_like(sortargs)
1130
+ rows[sortargs] = line[0]
1131
+ cols[sortargs] = line[1]
1132
+ out_lines.append([rows, cols])
1133
+
1134
+ return out_lines
1135
+
1136
+
1137
+ def _filter_ridge_lines(cwt, ridge_lines, window_size=None, min_length=None,
1138
+ min_snr=1, noise_perc=10):
1139
+ """
1140
+ Filter ridge lines according to prescribed criteria. Intended
1141
+ to be used for finding relative maxima.
1142
+
1143
+ Parameters
1144
+ ----------
1145
+ cwt : 2-D ndarray
1146
+ Continuous wavelet transform from which the `ridge_lines` were defined.
1147
+ ridge_lines : 1-D sequence
1148
+ Each element should contain 2 sequences, the rows and columns
1149
+ of the ridge line (respectively).
1150
+ window_size : int, optional
1151
+ Size of window to use to calculate noise floor.
1152
+ Default is ``cwt.shape[1] / 20``.
1153
+ min_length : int, optional
1154
+ Minimum length a ridge line needs to be acceptable.
1155
+ Default is ``cwt.shape[0] / 4``, ie 1/4-th the number of widths.
1156
+ min_snr : float, optional
1157
+ Minimum SNR ratio. Default 1. The signal is the value of
1158
+ the cwt matrix at the shortest length scale (``cwt[0, loc]``), the
1159
+ noise is the `noise_perc`\\ th percentile of datapoints contained within a
1160
+ window of `window_size` around ``cwt[0, loc]``.
1161
+ noise_perc : float, optional
1162
+ When calculating the noise floor, percentile of data points
1163
+ examined below which to consider noise. Calculated using
1164
+ scipy.stats.scoreatpercentile.
1165
+
1166
+ References
1167
+ ----------
1168
+ .. [1] Bioinformatics (2006) 22 (17): 2059-2065.
1169
+ :doi:`10.1093/bioinformatics/btl355`
1170
+
1171
+ """
1172
+ num_points = cwt.shape[1]
1173
+ if min_length is None:
1174
+ min_length = np.ceil(cwt.shape[0] / 4)
1175
+ if window_size is None:
1176
+ window_size = np.ceil(num_points / 20)
1177
+
1178
+ window_size = int(window_size)
1179
+ hf_window, odd = divmod(window_size, 2)
1180
+
1181
+ # Filter based on SNR
1182
+ row_one = cwt[0, :]
1183
+ noises = np.empty_like(row_one)
1184
+ for ind, val in enumerate(row_one):
1185
+ window_start = max(ind - hf_window, 0)
1186
+ window_end = min(ind + hf_window + odd, num_points)
1187
+ noises[ind] = scoreatpercentile(row_one[window_start:window_end],
1188
+ per=noise_perc)
1189
+
1190
+ def filt_func(line):
1191
+ if len(line[0]) < min_length:
1192
+ return False
1193
+ snr = abs(cwt[line[0][0], line[1][0]] / noises[line[1][0]])
1194
+ if snr < min_snr:
1195
+ return False
1196
+ return True
1197
+
1198
+ return list(filter(filt_func, ridge_lines))
1199
+
1200
+
1201
+ def find_peaks_cwt(vector, widths, wavelet=None, max_distances=None,
1202
+ gap_thresh=None, min_length=None,
1203
+ min_snr=1, noise_perc=10, window_size=None):
1204
+ """
1205
+ Find peaks in a 1-D array with wavelet transformation.
1206
+
1207
+ The general approach is to smooth `vector` by convolving it with
1208
+ `wavelet(width)` for each width in `widths`. Relative maxima which
1209
+ appear at enough length scales, and with sufficiently high SNR, are
1210
+ accepted.
1211
+
1212
+ Parameters
1213
+ ----------
1214
+ vector : ndarray
1215
+ 1-D array in which to find the peaks.
1216
+ widths : float or sequence
1217
+ Single width or 1-D array-like of widths to use for calculating
1218
+ the CWT matrix. In general,
1219
+ this range should cover the expected width of peaks of interest.
1220
+ wavelet : callable, optional
1221
+ Should take two parameters and return a 1-D array to convolve
1222
+ with `vector`. The first parameter determines the number of points
1223
+ of the returned wavelet array, the second parameter is the scale
1224
+ (`width`) of the wavelet. Should be normalized and symmetric.
1225
+ Default is the ricker wavelet.
1226
+ max_distances : ndarray, optional
1227
+ At each row, a ridge line is only connected if the relative max at
1228
+ row[n] is within ``max_distances[n]`` from the relative max at
1229
+ ``row[n+1]``. Default value is ``widths/4``.
1230
+ gap_thresh : float, optional
1231
+ If a relative maximum is not found within `max_distances`,
1232
+ there will be a gap. A ridge line is discontinued if there are more
1233
+ than `gap_thresh` points without connecting a new relative maximum.
1234
+ Default is the first value of the widths array i.e. widths[0].
1235
+ min_length : int, optional
1236
+ Minimum length a ridge line needs to be acceptable.
1237
+ Default is ``cwt.shape[0] / 4``, ie 1/4-th the number of widths.
1238
+ min_snr : float, optional
1239
+ Minimum SNR ratio. Default 1. The signal is the maximum CWT coefficient
1240
+ on the largest ridge line. The noise is `noise_perc` th percentile of
1241
+ datapoints contained within the same ridge line.
1242
+ noise_perc : float, optional
1243
+ When calculating the noise floor, percentile of data points
1244
+ examined below which to consider noise. Calculated using
1245
+ `stats.scoreatpercentile`. Default is 10.
1246
+ window_size : int, optional
1247
+ Size of window to use to calculate noise floor.
1248
+ Default is ``cwt.shape[1] / 20``.
1249
+
1250
+ Returns
1251
+ -------
1252
+ peaks_indices : ndarray
1253
+ Indices of the locations in the `vector` where peaks were found.
1254
+ The list is sorted.
1255
+
1256
+ See Also
1257
+ --------
1258
+ cwt
1259
+ Continuous wavelet transform.
1260
+ find_peaks
1261
+ Find peaks inside a signal based on peak properties.
1262
+
1263
+ Notes
1264
+ -----
1265
+ This approach was designed for finding sharp peaks among noisy data,
1266
+ however with proper parameter selection it should function well for
1267
+ different peak shapes.
1268
+
1269
+ The algorithm is as follows:
1270
+ 1. Perform a continuous wavelet transform on `vector`, for the supplied
1271
+ `widths`. This is a convolution of `vector` with `wavelet(width)` for
1272
+ each width in `widths`. See `cwt`.
1273
+ 2. Identify "ridge lines" in the cwt matrix. These are relative maxima
1274
+ at each row, connected across adjacent rows. See identify_ridge_lines
1275
+ 3. Filter the ridge_lines using filter_ridge_lines.
1276
+
1277
+ .. versionadded:: 0.11.0
1278
+
1279
+ References
1280
+ ----------
1281
+ .. [1] Bioinformatics (2006) 22 (17): 2059-2065.
1282
+ :doi:`10.1093/bioinformatics/btl355`
1283
+
1284
+ Examples
1285
+ --------
1286
+ >>> import numpy as np
1287
+ >>> from scipy import signal
1288
+ >>> xs = np.arange(0, np.pi, 0.05)
1289
+ >>> data = np.sin(xs)
1290
+ >>> peakind = signal.find_peaks_cwt(data, np.arange(1,10))
1291
+ >>> peakind, xs[peakind], data[peakind]
1292
+ ([32], array([ 1.6]), array([ 0.9995736]))
1293
+
1294
+ """
1295
+ widths = np.atleast_1d(np.asarray(widths))
1296
+
1297
+ if gap_thresh is None:
1298
+ gap_thresh = np.ceil(widths[0])
1299
+ if max_distances is None:
1300
+ max_distances = widths / 4.0
1301
+ if wavelet is None:
1302
+ wavelet = _ricker
1303
+
1304
+ cwt_dat = _cwt(vector, wavelet, widths)
1305
+ ridge_lines = _identify_ridge_lines(cwt_dat, max_distances, gap_thresh)
1306
+ filtered = _filter_ridge_lines(cwt_dat, ridge_lines, min_length=min_length,
1307
+ window_size=window_size, min_snr=min_snr,
1308
+ noise_perc=noise_perc)
1309
+ max_locs = np.asarray([x[1][0] for x in filtered])
1310
+ max_locs.sort()
1311
+
1312
+ return max_locs
parrot/lib/python3.10/site-packages/scipy/signal/lti_conversion.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is not meant for public use and will be removed in SciPy v2.0.0.
2
+ # Use the `scipy.signal` namespace for importing the functions
3
+ # included below.
4
+
5
+ from scipy._lib.deprecation import _sub_module_deprecation
6
+
7
+ __all__ = [ # noqa: F822
8
+ 'tf2ss', 'abcd_normalize', 'ss2tf', 'zpk2ss', 'ss2zpk',
9
+ 'cont2discrete', 'tf2zpk', 'zpk2tf', 'normalize'
10
+ ]
11
+
12
+
13
+ def __dir__():
14
+ return __all__
15
+
16
+
17
+ def __getattr__(name):
18
+ return _sub_module_deprecation(sub_package="signal", module="lti_conversion",
19
+ private_modules=["_lti_conversion"], all=__all__,
20
+ attribute=name)
parrot/lib/python3.10/site-packages/scipy/signal/tests/__init__.py ADDED
File without changes
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_conj_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor _conj(const at::Tensor & self);
21
+
22
+ } // namespace compositeexplicitautograd
23
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_flash_attention_forward.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/_flash_attention_forward_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::_flash_attention_forward(Tensor query, Tensor key, Tensor value, Tensor? cum_seq_q, Tensor? cum_seq_k, SymInt max_q, SymInt max_k, float dropout_p, bool is_causal, bool return_debug_mask, *, float? scale=None) -> (Tensor output, Tensor softmax_logsumexp, Tensor philox_seed, Tensor philox_offset, Tensor debug_attn_mask)
26
+ inline ::std::tuple<at::Tensor,at::Tensor,at::Tensor,at::Tensor,at::Tensor> _flash_attention_forward(const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const c10::optional<at::Tensor> & cum_seq_q, const c10::optional<at::Tensor> & cum_seq_k, int64_t max_q, int64_t max_k, double dropout_p, bool is_causal, bool return_debug_mask, c10::optional<double> scale=c10::nullopt) {
27
+ return at::_ops::_flash_attention_forward::call(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale);
28
+ }
29
+ namespace symint {
30
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
31
+ ::std::tuple<at::Tensor,at::Tensor,at::Tensor,at::Tensor,at::Tensor> _flash_attention_forward(const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const c10::optional<at::Tensor> & cum_seq_q, const c10::optional<at::Tensor> & cum_seq_k, int64_t max_q, int64_t max_k, double dropout_p, bool is_causal, bool return_debug_mask, c10::optional<double> scale=c10::nullopt) {
32
+ return at::_ops::_flash_attention_forward::call(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale);
33
+ }
34
+ }
35
+
36
+ // aten::_flash_attention_forward(Tensor query, Tensor key, Tensor value, Tensor? cum_seq_q, Tensor? cum_seq_k, SymInt max_q, SymInt max_k, float dropout_p, bool is_causal, bool return_debug_mask, *, float? scale=None) -> (Tensor output, Tensor softmax_logsumexp, Tensor philox_seed, Tensor philox_offset, Tensor debug_attn_mask)
37
+ inline ::std::tuple<at::Tensor,at::Tensor,at::Tensor,at::Tensor,at::Tensor> _flash_attention_forward_symint(const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const c10::optional<at::Tensor> & cum_seq_q, const c10::optional<at::Tensor> & cum_seq_k, c10::SymInt max_q, c10::SymInt max_k, double dropout_p, bool is_causal, bool return_debug_mask, c10::optional<double> scale=c10::nullopt) {
38
+ return at::_ops::_flash_attention_forward::call(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale);
39
+ }
40
+ namespace symint {
41
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
42
+ ::std::tuple<at::Tensor,at::Tensor,at::Tensor,at::Tensor,at::Tensor> _flash_attention_forward(const at::Tensor & query, const at::Tensor & key, const at::Tensor & value, const c10::optional<at::Tensor> & cum_seq_q, const c10::optional<at::Tensor> & cum_seq_k, c10::SymInt max_q, c10::SymInt max_k, double dropout_p, bool is_causal, bool return_debug_mask, c10::optional<double> scale=c10::nullopt) {
43
+ return at::_ops::_flash_attention_forward::call(query, key, value, cum_seq_q, cum_seq_k, max_q, max_k, dropout_p, is_causal, return_debug_mask, scale);
44
+ }
45
+ }
46
+
47
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_cosh_native.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API void _foreach_cosh_out(at::TensorList self, at::TensorList out);
20
+ TORCH_API ::std::vector<at::Tensor> foreach_tensor_cosh_slow(at::TensorList self);
21
+ TORCH_API void foreach_tensor_cosh_slow_(at::TensorList self);
22
+ TORCH_API ::std::vector<at::Tensor> foreach_tensor_cosh_cuda(at::TensorList self);
23
+ TORCH_API void foreach_tensor_cosh_cuda_(at::TensorList self);
24
+ } // namespace native
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_foreach_sin.h ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/_foreach_sin_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::_foreach_sin(Tensor[] self) -> Tensor[]
26
+ inline ::std::vector<at::Tensor> _foreach_sin(at::TensorList self) {
27
+ return at::_ops::_foreach_sin::call(self);
28
+ }
29
+
30
+ // aten::_foreach_sin_(Tensor(a!)[] self) -> ()
31
+ inline void _foreach_sin_(at::TensorList self) {
32
+ return at::_ops::_foreach_sin_::call(self);
33
+ }
34
+
35
+ // aten::_foreach_sin.out(Tensor[] self, *, Tensor(a!)[] out) -> ()
36
+ inline void _foreach_sin_out(at::TensorList out, at::TensorList self) {
37
+ return at::_ops::_foreach_sin_out::call(self, out);
38
+ }
39
+ // aten::_foreach_sin.out(Tensor[] self, *, Tensor(a!)[] out) -> ()
40
+ inline void _foreach_sin_outf(at::TensorList self, at::TensorList out) {
41
+ return at::_ops::_foreach_sin_out::call(self, out);
42
+ }
43
+
44
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_new_zeros_with_same_feature_meta_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor _new_zeros_with_same_feature_meta(const at::Tensor & self, const at::Tensor & other, int64_t self_num_batch_dims=0);
21
+ TORCH_API at::Tensor & _new_zeros_with_same_feature_meta_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other, int64_t self_num_batch_dims=0);
22
+ TORCH_API at::Tensor & _new_zeros_with_same_feature_meta_outf(const at::Tensor & self, const at::Tensor & other, int64_t self_num_batch_dims, at::Tensor & out);
23
+
24
+ } // namespace compositeexplicitautograd
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_nnz_ops.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API _nnz {
18
+ using schema = int64_t (const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_nnz")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_nnz(Tensor self) -> int")
24
+ static int64_t call(const at::Tensor & self);
25
+ static int64_t redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
26
+ };
27
+
28
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_sparse_mm_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API _sparse_mm {
18
+ using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_sparse_mm")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_sparse_mm(Tensor sparse, Tensor dense) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & sparse, const at::Tensor & dense);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & sparse, const at::Tensor & dense);
26
+ };
27
+
28
+ struct TORCH_API _sparse_mm_reduce {
29
+ using schema = at::Tensor (const at::Tensor &, const at::Tensor &, c10::string_view);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_sparse_mm")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "reduce")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_sparse_mm.reduce(Tensor sparse, Tensor dense, str reduce) -> Tensor")
35
+ static at::Tensor call(const at::Tensor & sparse, const at::Tensor & dense, c10::string_view reduce);
36
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & sparse, const at::Tensor & dense, c10::string_view reduce);
37
+ };
38
+
39
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_thnn_fused_gru_cell_backward.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/_thnn_fused_gru_cell_backward_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::_thnn_fused_gru_cell_backward(Tensor grad_hy, Tensor workspace, bool has_bias) -> (Tensor, Tensor, Tensor, Tensor, Tensor)
26
+ inline ::std::tuple<at::Tensor,at::Tensor,at::Tensor,at::Tensor,at::Tensor> _thnn_fused_gru_cell_backward(const at::Tensor & grad_hy, const at::Tensor & workspace, bool has_bias) {
27
+ return at::_ops::_thnn_fused_gru_cell_backward::call(grad_hy, workspace, has_bias);
28
+ }
29
+
30
+ // aten::_thnn_fused_gru_cell_backward.out(Tensor grad_hy, Tensor workspace, bool has_bias, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2, Tensor(d!) out3, Tensor(e!) out4) -> (Tensor(a!), Tensor(b!), Tensor(c!), Tensor(d!), Tensor(e!))
31
+ inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &,at::Tensor &,at::Tensor &> _thnn_fused_gru_cell_backward_out(at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, at::Tensor & out3, at::Tensor & out4, const at::Tensor & grad_hy, const at::Tensor & workspace, bool has_bias) {
32
+ return at::_ops::_thnn_fused_gru_cell_backward_out::call(grad_hy, workspace, has_bias, out0, out1, out2, out3, out4);
33
+ }
34
+ // aten::_thnn_fused_gru_cell_backward.out(Tensor grad_hy, Tensor workspace, bool has_bias, *, Tensor(a!) out0, Tensor(b!) out1, Tensor(c!) out2, Tensor(d!) out3, Tensor(e!) out4) -> (Tensor(a!), Tensor(b!), Tensor(c!), Tensor(d!), Tensor(e!))
35
+ inline ::std::tuple<at::Tensor &,at::Tensor &,at::Tensor &,at::Tensor &,at::Tensor &> _thnn_fused_gru_cell_backward_outf(const at::Tensor & grad_hy, const at::Tensor & workspace, bool has_bias, at::Tensor & out0, at::Tensor & out1, at::Tensor & out2, at::Tensor & out3, at::Tensor & out4) {
36
+ return at::_ops::_thnn_fused_gru_cell_backward_out::call(grad_hy, workspace, has_bias, out0, out1, out2, out3, out4);
37
+ }
38
+
39
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/_unique.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/_unique_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::_unique(Tensor self, bool sorted=True, bool return_inverse=False) -> (Tensor, Tensor)
26
+ inline ::std::tuple<at::Tensor,at::Tensor> _unique(const at::Tensor & self, bool sorted=true, bool return_inverse=false) {
27
+ return at::_ops::_unique::call(self, sorted, return_inverse);
28
+ }
29
+
30
+ // aten::_unique.out(Tensor self, bool sorted=True, bool return_inverse=False, *, Tensor(a!) out0, Tensor(b!) out1) -> (Tensor(a!), Tensor(b!))
31
+ inline ::std::tuple<at::Tensor &,at::Tensor &> _unique_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & self, bool sorted=true, bool return_inverse=false) {
32
+ return at::_ops::_unique_out::call(self, sorted, return_inverse, out0, out1);
33
+ }
34
+ // aten::_unique.out(Tensor self, bool sorted=True, bool return_inverse=False, *, Tensor(a!) out0, Tensor(b!) out1) -> (Tensor(a!), Tensor(b!))
35
+ inline ::std::tuple<at::Tensor &,at::Tensor &> _unique_outf(const at::Tensor & self, bool sorted, bool return_inverse, at::Tensor & out0, at::Tensor & out1) {
36
+ return at::_ops::_unique_out::call(self, sorted, return_inverse, out0, out1);
37
+ }
38
+
39
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/adaptive_max_pool2d_meta.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeMetaFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/TensorIterator.h>
13
+ #include <ATen/TensorMeta.h>
14
+ #include <tuple>
15
+ #include <vector>
16
+
17
+ namespace at {
18
+ namespace meta {
19
+
20
+ struct TORCH_API structured_adaptive_max_pool2d : public at::impl::MetaBase {
21
+
22
+
23
+ void meta(const at::Tensor & self, at::IntArrayRef output_size);
24
+ };
25
+
26
+ } // namespace native
27
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/aminmax_cpu_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor> aminmax(const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
21
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> aminmax_out(at::Tensor & min, at::Tensor & max, const at::Tensor & self, c10::optional<int64_t> dim=c10::nullopt, bool keepdim=false);
22
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> aminmax_outf(const at::Tensor & self, c10::optional<int64_t> dim, bool keepdim, at::Tensor & min, at::Tensor & max);
23
+
24
+ } // namespace cpu
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/atan_cuda_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cuda {
19
+
20
+ TORCH_API at::Tensor atan(const at::Tensor & self);
21
+ TORCH_API at::Tensor & atan_out(at::Tensor & out, const at::Tensor & self);
22
+ TORCH_API at::Tensor & atan_outf(const at::Tensor & self, at::Tensor & out);
23
+ TORCH_API at::Tensor & atan_(at::Tensor & self);
24
+
25
+ } // namespace cuda
26
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/baddbmm_native.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+ #include <ATen/ops/baddbmm_meta.h>
16
+
17
+ namespace at {
18
+ namespace native {
19
+ struct TORCH_API structured_baddbmm_out_cpu : public at::meta::structured_baddbmm {
20
+ void impl(const at::Tensor & self, const at::Tensor & batch1, const at::Tensor & batch2, const at::Scalar & beta, const at::Scalar & alpha, const at::Tensor & out);
21
+ };
22
+ struct TORCH_API structured_baddbmm_out_cuda : public at::meta::structured_baddbmm {
23
+ void impl(const at::Tensor & self, const at::Tensor & batch1, const at::Tensor & batch2, const at::Scalar & beta, const at::Scalar & alpha, const at::Tensor & out);
24
+ };
25
+ TORCH_API at::Tensor & baddbmm_out_sparse_csr_cuda(const at::Tensor & self, const at::Tensor & batch1, const at::Tensor & batch2, const at::Scalar & beta, const at::Scalar & alpha, at::Tensor & out);
26
+ } // namespace native
27
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/bmm_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API bmm {
18
+ using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::bmm")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "bmm(Tensor self, Tensor mat2) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self, const at::Tensor & mat2);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & mat2);
26
+ };
27
+
28
+ struct TORCH_API bmm_out {
29
+ using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::bmm")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "bmm.out(Tensor self, Tensor mat2, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, const at::Tensor & mat2, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & mat2, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/diag_embed_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor & diag_embed_out(at::Tensor & out, const at::Tensor & self, int64_t offset=0, int64_t dim1=-2, int64_t dim2=-1);
21
+ TORCH_API at::Tensor & diag_embed_outf(const at::Tensor & self, int64_t offset, int64_t dim1, int64_t dim2, at::Tensor & out);
22
+
23
+ } // namespace compositeexplicitautograd
24
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/fft_irfftn_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API fft_irfftn {
18
+ using schema = at::Tensor (const at::Tensor &, at::OptionalSymIntArrayRef, at::OptionalIntArrayRef, c10::optional<c10::string_view>);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::fft_irfftn")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "fft_irfftn(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional<c10::string_view> norm);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional<c10::string_view> norm);
26
+ };
27
+
28
+ struct TORCH_API fft_irfftn_out {
29
+ using schema = at::Tensor & (const at::Tensor &, at::OptionalSymIntArrayRef, at::OptionalIntArrayRef, c10::optional<c10::string_view>, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::fft_irfftn")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "fft_irfftn.out(Tensor self, SymInt[1]? s=None, int[1]? dim=None, str? norm=None, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional<c10::string_view> norm, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::OptionalSymIntArrayRef s, at::OptionalIntArrayRef dim, c10::optional<c10::string_view> norm, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/full_ops.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API full_names {
18
+ using schema = at::Tensor (at::IntArrayRef, const at::Scalar &, c10::optional<at::DimnameList>, c10::optional<at::ScalarType>, c10::optional<at::Layout>, c10::optional<at::Device>, c10::optional<bool>);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::full")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "names")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "full.names(int[] size, Scalar fill_value, *, Dimname[]? names, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor")
24
+ static at::Tensor call(at::IntArrayRef size, const at::Scalar & fill_value, c10::optional<at::DimnameList> names, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, at::IntArrayRef size, const at::Scalar & fill_value, c10::optional<at::DimnameList> names, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
26
+ };
27
+
28
+ struct TORCH_API full {
29
+ using schema = at::Tensor (c10::SymIntArrayRef, const at::Scalar &, c10::optional<at::ScalarType>, c10::optional<at::Layout>, c10::optional<at::Device>, c10::optional<bool>);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::full")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "full(SymInt[] size, Scalar fill_value, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor")
35
+ static at::Tensor call(c10::SymIntArrayRef size, const at::Scalar & fill_value, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
36
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, c10::SymIntArrayRef size, const at::Scalar & fill_value, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
37
+ };
38
+
39
+ struct TORCH_API full_out {
40
+ using schema = at::Tensor & (c10::SymIntArrayRef, const at::Scalar &, at::Tensor &);
41
+ using ptr_schema = schema*;
42
+ // See Note [static constexpr char* members for windows NVCC]
43
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::full")
44
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
45
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "full.out(SymInt[] size, Scalar fill_value, *, Tensor(a!) out) -> Tensor(a!)")
46
+ static at::Tensor & call(c10::SymIntArrayRef size, const at::Scalar & fill_value, at::Tensor & out);
47
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, c10::SymIntArrayRef size, const at::Scalar & fill_value, at::Tensor & out);
48
+ };
49
+
50
+ struct TORCH_API full_names_out {
51
+ using schema = at::Tensor & (at::IntArrayRef, const at::Scalar &, c10::optional<at::DimnameList>, at::Tensor &);
52
+ using ptr_schema = schema*;
53
+ // See Note [static constexpr char* members for windows NVCC]
54
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::full")
55
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "names_out")
56
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "full.names_out(int[] size, Scalar fill_value, *, Dimname[]? names, Tensor(a!) out) -> Tensor(a!)")
57
+ static at::Tensor & call(at::IntArrayRef size, const at::Scalar & fill_value, c10::optional<at::DimnameList> names, at::Tensor & out);
58
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::IntArrayRef size, const at::Scalar & fill_value, c10::optional<at::DimnameList> names, at::Tensor & out);
59
+ };
60
+
61
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/gelu_compositeexplicitautogradnonfunctional_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautogradnonfunctional {
19
+
20
+ TORCH_API at::Tensor gelu(const at::Tensor & self, c10::string_view approximate="none");
21
+ TORCH_API at::Tensor & gelu_(at::Tensor & self, c10::string_view approximate="none");
22
+
23
+ } // namespace compositeexplicitautogradnonfunctional
24
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/gru.h ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/gru_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::gru.input(Tensor input, Tensor hx, Tensor[] params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional, bool batch_first) -> (Tensor, Tensor)
26
+ inline ::std::tuple<at::Tensor,at::Tensor> gru(const at::Tensor & input, const at::Tensor & hx, at::TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional, bool batch_first) {
27
+ return at::_ops::gru_input::call(input, hx, params, has_biases, num_layers, dropout, train, bidirectional, batch_first);
28
+ }
29
+
30
+ // aten::gru.data(Tensor data, Tensor batch_sizes, Tensor hx, Tensor[] params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional) -> (Tensor, Tensor)
31
+ inline ::std::tuple<at::Tensor,at::Tensor> gru(const at::Tensor & data, const at::Tensor & batch_sizes, const at::Tensor & hx, at::TensorList params, bool has_biases, int64_t num_layers, double dropout, bool train, bool bidirectional) {
32
+ return at::_ops::gru_data::call(data, batch_sizes, hx, params, has_biases, num_layers, dropout, train, bidirectional);
33
+ }
34
+
35
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/histc_cuda_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cuda {
19
+
20
+ TORCH_API at::Tensor histc(const at::Tensor & self, int64_t bins=100, const at::Scalar & min=0, const at::Scalar & max=0);
21
+ TORCH_API at::Tensor & histc_out(at::Tensor & out, const at::Tensor & self, int64_t bins=100, const at::Scalar & min=0, const at::Scalar & max=0);
22
+ TORCH_API at::Tensor & histc_outf(const at::Tensor & self, int64_t bins, const at::Scalar & min, const at::Scalar & max, at::Tensor & out);
23
+
24
+ } // namespace cuda
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/kron.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/kron_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::kron(Tensor self, Tensor other) -> Tensor
26
+ inline at::Tensor kron(const at::Tensor & self, const at::Tensor & other) {
27
+ return at::_ops::kron::call(self, other);
28
+ }
29
+
30
+ // aten::kron.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
31
+ inline at::Tensor & kron_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other) {
32
+ return at::_ops::kron_out::call(self, other, out);
33
+ }
34
+ // aten::kron.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
35
+ inline at::Tensor & kron_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out) {
36
+ return at::_ops::kron_out::call(self, other, out);
37
+ }
38
+
39
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/lgamma_cpu_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor lgamma(const at::Tensor & self);
21
+ TORCH_API at::Tensor & lgamma_out(at::Tensor & out, const at::Tensor & self);
22
+ TORCH_API at::Tensor & lgamma_outf(const at::Tensor & self, at::Tensor & out);
23
+ TORCH_API at::Tensor & lgamma_(at::Tensor & self);
24
+
25
+ } // namespace cpu
26
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/log_sigmoid_native.h ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor log_sigmoid(const at::Tensor & self);
20
+ TORCH_API at::Tensor & log_sigmoid_out(const at::Tensor & self, at::Tensor & out);
21
+ } // namespace native
22
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/logical_not_ops.h ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API logical_not {
18
+ using schema = at::Tensor (const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::logical_not")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "logical_not(Tensor self) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
26
+ };
27
+
28
+ struct TORCH_API logical_not_ {
29
+ using schema = at::Tensor & (at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::logical_not_")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "logical_not_(Tensor(a!) self) -> Tensor(a!)")
35
+ static at::Tensor & call(at::Tensor & self);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, at::Tensor & self);
37
+ };
38
+
39
+ struct TORCH_API logical_not_out {
40
+ using schema = at::Tensor & (const at::Tensor &, at::Tensor &);
41
+ using ptr_schema = schema*;
42
+ // See Note [static constexpr char* members for windows NVCC]
43
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::logical_not")
44
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
45
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "logical_not.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
46
+ static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
47
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
48
+ };
49
+
50
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/matmul_backward_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> matmul_backward_out(at::Tensor & out0, at::Tensor & out1, const at::Tensor & grad, const at::Tensor & self, const at::Tensor & other, ::std::array<bool,2> mask);
21
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> matmul_backward_outf(const at::Tensor & grad, const at::Tensor & self, const at::Tensor & other, ::std::array<bool,2> mask, at::Tensor & out0, at::Tensor & out1);
22
+
23
+ } // namespace compositeexplicitautograd
24
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/mkldnn_max_pool2d_compositeexplicitautograd_dispatch.h ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor & mkldnn_max_pool2d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride={}, at::IntArrayRef padding=0, at::IntArrayRef dilation=1, bool ceil_mode=false);
21
+ TORCH_API at::Tensor & mkldnn_max_pool2d_outf(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride, at::IntArrayRef padding, at::IntArrayRef dilation, bool ceil_mode, at::Tensor & out);
22
+
23
+ } // namespace compositeexplicitautograd
24
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/multilabel_margin_loss_forward_cuda_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cuda {
19
+
20
+ TORCH_API ::std::tuple<at::Tensor,at::Tensor> multilabel_margin_loss_forward(const at::Tensor & self, const at::Tensor & target, int64_t reduction);
21
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> multilabel_margin_loss_forward_out(at::Tensor & output, at::Tensor & is_target, const at::Tensor & self, const at::Tensor & target, int64_t reduction);
22
+ TORCH_API ::std::tuple<at::Tensor &,at::Tensor &> multilabel_margin_loss_forward_outf(const at::Tensor & self, const at::Tensor & target, int64_t reduction, at::Tensor & output, at::Tensor & is_target);
23
+
24
+ } // namespace cuda
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/nonzero_numpy_ops.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API nonzero_numpy {
18
+ using schema = ::std::vector<at::Tensor> (const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::nonzero_numpy")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "nonzero_numpy(Tensor self) -> Tensor[]")
24
+ static ::std::vector<at::Tensor> call(const at::Tensor & self);
25
+ static ::std::vector<at::Tensor> redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
26
+ };
27
+
28
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/pad.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/pad_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::pad(Tensor self, SymInt[] pad, str mode="constant", float? value=None) -> Tensor
26
+ inline at::Tensor pad(const at::Tensor & self, at::IntArrayRef pad, c10::string_view mode="constant", c10::optional<double> value=c10::nullopt) {
27
+ return at::_ops::pad::call(self, c10::fromIntArrayRefSlow(pad), mode, value);
28
+ }
29
+ namespace symint {
30
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
31
+ at::Tensor pad(const at::Tensor & self, at::IntArrayRef pad, c10::string_view mode="constant", c10::optional<double> value=c10::nullopt) {
32
+ return at::_ops::pad::call(self, c10::fromIntArrayRefSlow(pad), mode, value);
33
+ }
34
+ }
35
+
36
+ // aten::pad(Tensor self, SymInt[] pad, str mode="constant", float? value=None) -> Tensor
37
+ inline at::Tensor pad_symint(const at::Tensor & self, c10::SymIntArrayRef pad, c10::string_view mode="constant", c10::optional<double> value=c10::nullopt) {
38
+ return at::_ops::pad::call(self, pad, mode, value);
39
+ }
40
+ namespace symint {
41
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
42
+ at::Tensor pad(const at::Tensor & self, c10::SymIntArrayRef pad, c10::string_view mode="constant", c10::optional<double> value=c10::nullopt) {
43
+ return at::_ops::pad::call(self, pad, mode, value);
44
+ }
45
+ }
46
+
47
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/refine_names_compositeimplicitautograd_dispatch.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace compositeimplicitautograd {
19
+
20
+ TORCH_API at::Tensor refine_names(const at::Tensor & self, at::DimnameList names);
21
+
22
+ } // namespace compositeimplicitautograd
23
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/reflection_pad1d_native.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+ #include <ATen/ops/reflection_pad1d_meta.h>
16
+
17
+ namespace at {
18
+ namespace native {
19
+ struct TORCH_API structured_reflection_pad1d_out_cpu : public at::meta::structured_reflection_pad1d {
20
+ void impl(const at::Tensor & self, at::ArrayRef<int64_t> padding, const at::Tensor & out);
21
+ };
22
+ struct TORCH_API structured_reflection_pad1d_out_cuda : public at::meta::structured_reflection_pad1d {
23
+ void impl(const at::Tensor & self, at::ArrayRef<int64_t> padding, const at::Tensor & out);
24
+ };
25
+ TORCH_API at::Tensor & reflection_pad1d_out_quantized_cpu(const at::Tensor & self, at::IntArrayRef padding, at::Tensor & out);
26
+ } // namespace native
27
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/remainder_meta_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace meta {
19
+
20
+ TORCH_API at::Tensor remainder(const at::Tensor & self, const at::Tensor & other);
21
+ TORCH_API at::Tensor & remainder_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
22
+ TORCH_API at::Tensor & remainder_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
23
+ TORCH_API at::Tensor & remainder_(at::Tensor & self, const at::Tensor & other);
24
+
25
+ } // namespace meta
26
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/scalar_tensor.h ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/scalar_tensor_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::scalar_tensor(Scalar s, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
26
+ inline at::Tensor scalar_tensor(const at::Scalar & s, at::TensorOptions options={}) {
27
+ return at::_ops::scalar_tensor::call(s, optTypeMetaToScalarType(options.dtype_opt()), options.layout_opt(), options.device_opt(), options.pinned_memory_opt());
28
+ }
29
+ // aten::scalar_tensor(Scalar s, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
30
+ inline at::Tensor scalar_tensor(const at::Scalar & s, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory) {
31
+ return at::_ops::scalar_tensor::call(s, dtype, layout, device, pin_memory);
32
+ }
33
+
34
+ // aten::scalar_tensor.out(Scalar s, *, Tensor(a!) out) -> Tensor(a!)
35
+ inline at::Tensor & scalar_tensor_out(at::Tensor & out, const at::Scalar & s) {
36
+ return at::_ops::scalar_tensor_out::call(s, out);
37
+ }
38
+ // aten::scalar_tensor.out(Scalar s, *, Tensor(a!) out) -> Tensor(a!)
39
+ inline at::Tensor & scalar_tensor_outf(const at::Scalar & s, at::Tensor & out) {
40
+ return at::_ops::scalar_tensor_out::call(s, out);
41
+ }
42
+
43
+ }
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_entr_meta_dispatch.h ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace meta {
19
+
20
+ TORCH_API at::Tensor special_entr(const at::Tensor & self);
21
+ TORCH_API at::Tensor & special_entr_out(at::Tensor & out, const at::Tensor & self);
22
+ TORCH_API at::Tensor & special_entr_outf(const at::Tensor & self, at::Tensor & out);
23
+
24
+ } // namespace meta
25
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/special_entr_ops.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API special_entr {
18
+ using schema = at::Tensor (const at::Tensor &);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::special_entr")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "special_entr(Tensor self) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self);
26
+ };
27
+
28
+ struct TORCH_API special_entr_out {
29
+ using schema = at::Tensor & (const at::Tensor &, at::Tensor &);
30
+ using ptr_schema = schema*;
31
+ // See Note [static constexpr char* members for windows NVCC]
32
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::special_entr")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "special_entr.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/sum_meta.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeMetaFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/TensorIterator.h>
13
+ #include <ATen/TensorMeta.h>
14
+ #include <tuple>
15
+ #include <vector>
16
+
17
+ namespace at {
18
+ namespace meta {
19
+
20
+ struct TORCH_API structured_sum_dim_IntList : public at::impl::MetaBase {
21
+
22
+
23
+ void meta(const at::Tensor & self, at::OptionalIntArrayRef dim, bool keepdim, c10::optional<at::ScalarType> dtype);
24
+ };
25
+
26
+ } // namespace native
27
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/to_dense_ops.h ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Operator.h
4
+
5
+ #include <tuple>
6
+ #include <vector>
7
+
8
+ // Forward declarations of any types needed in the operator signatures.
9
+ // We can't directly include these classes because it will cause circular include dependencies.
10
+ // This file is included by TensorBody.h, which defines the Tensor class.
11
+ #include <ATen/core/ATen_fwd.h>
12
+
13
+ namespace at {
14
+ namespace _ops {
15
+
16
+
17
+ struct TORCH_API to_dense {
18
+ using schema = at::Tensor (const at::Tensor &, c10::optional<at::ScalarType>, c10::optional<bool>);
19
+ using ptr_schema = schema*;
20
+ // See Note [static constexpr char* members for windows NVCC]
21
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::to_dense")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "to_dense(Tensor self, ScalarType? dtype=None, *, bool? masked_grad=None) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self, c10::optional<at::ScalarType> dtype, c10::optional<bool> masked_grad);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, c10::optional<at::ScalarType> dtype, c10::optional<bool> masked_grad);
26
+ };
27
+
28
+ }} // namespace at::_ops
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/trunc_cpu_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+ // @generated by torchgen/gen.py from DispatchKeyFunction.h
3
+
4
+ // NB: The implementing C++ file is RegisterDispatchKey.cpp
5
+
6
+ // The only #includes we need are for custom classes that have defaults in the C++ API
7
+ #include <c10/core/MemoryFormat.h>
8
+ #include <c10/core/Scalar.h>
9
+ #include <ATen/core/Reduction.h>
10
+
11
+ // Forward declarations of any types needed in the operator signatures.
12
+ // We can't directly include these classes because it will cause circular include dependencies.
13
+ // This file is included by TensorBody.h, which defines the Tensor class.
14
+ #include <ATen/core/ATen_fwd.h>
15
+
16
+ namespace at {
17
+
18
+ namespace cpu {
19
+
20
+ TORCH_API at::Tensor trunc(const at::Tensor & self);
21
+ TORCH_API at::Tensor & trunc_out(at::Tensor & out, const at::Tensor & self);
22
+ TORCH_API at::Tensor & trunc_outf(const at::Tensor & self, at::Tensor & out);
23
+ TORCH_API at::Tensor & trunc_(at::Tensor & self);
24
+
25
+ } // namespace cpu
26
+ } // namespace at
videollama2/lib/python3.10/site-packages/torch/include/ATen/ops/unsqueeze.h ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from Function.h
4
+
5
+ #include <ATen/Context.h>
6
+ #include <ATen/DeviceGuard.h>
7
+ #include <ATen/TensorUtils.h>
8
+ #include <ATen/TracerMode.h>
9
+ #include <ATen/core/Generator.h>
10
+ #include <ATen/core/Reduction.h>
11
+ #include <ATen/core/Tensor.h>
12
+ #include <c10/core/Scalar.h>
13
+ #include <c10/core/Storage.h>
14
+ #include <c10/core/TensorOptions.h>
15
+ #include <c10/util/Deprecated.h>
16
+ #include <c10/util/Optional.h>
17
+
18
+
19
+
20
+ #include <ATen/ops/unsqueeze_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::unsqueeze(Tensor(a) self, int dim) -> Tensor(a)
26
+ inline at::Tensor unsqueeze(const at::Tensor & self, int64_t dim) {
27
+ return at::_ops::unsqueeze::call(self, dim);
28
+ }
29
+
30
+ }
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (173 Bytes). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (282 Bytes). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/config.cpython-310.pyc ADDED
Binary file (853 Bytes). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/core.cpython-310.pyc ADDED
Binary file (4.67 kB). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/data.cpython-310.pyc ADDED
Binary file (250 Bytes). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/dacite/__pycache__/dataclasses.cpython-310.pyc ADDED
Binary file (1.57 kB). View file
 
vllm/lib/python3.10/site-packages/ray/_private/thirdparty/pathspec/compat.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # encoding: utf-8
2
+ """
3
+ This module provides compatibility between Python 2 and 3. Hardly
4
+ anything is used by this project to constitute including `six`_.
5
+
6
+ .. _`six`: http://pythonhosted.org/six
7
+ """
8
+
9
+ import sys
10
+
11
+ if sys.version_info[0] < 3:
12
+ # Python 2.
13
+ unicode = unicode
14
+ string_types = (basestring,)
15
+
16
+ from collections import Iterable
17
+ from itertools import izip_longest
18
+
19
+ def iterkeys(mapping):
20
+ return mapping.iterkeys()
21
+
22
+ else:
23
+ # Python 3.
24
+ unicode = str
25
+ string_types = (unicode,)
26
+
27
+ from collections.abc import Iterable
28
+ from itertools import zip_longest as izip_longest
29
+
30
+ def iterkeys(mapping):
31
+ return mapping.keys()
32
+
33
+ try:
34
+ # Python 3.6+.
35
+ from collections.abc import Collection
36
+ except ImportError:
37
+ # Python 2.7 - 3.5.
38
+ from collections import Container as Collection