Skip to content

Commit 0472a1a

Browse files
committed
涉及到的api有
paddle.amp.decorate paddle.static.npu_places paddle.signal.istft paddle.signal.stft paddle.linalg.eigvalsh paddle.randint_like
1 parent dd57860 commit 0472a1a

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

python/paddle/amp/auto_cast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def decorate(
9696
Args:
9797
models(Layer|list of Layer, optional): The defined models by user, models must be either a single model or a list of models. Default is None.
9898
optimizers(Optimizer|list of Optimizer, optional): The defined optimizers by user, optimizers must be either a single optimizer or a list of optimizers. Default is None.
99-
level(str, optional): Auto mixed precision level. Accepted values are "O1" and "O2": O1 represent mixed precision, the decorator will do nothing;
99+
level(str, optional): Auto mixed precision level. Accepted values are O1 and O2: O1 represent mixed precision, the decorator will do nothing;
100100
O2 represent Pure float16/bfloat16, the decorator will cast all parameters of models to float16/bfloat16, except BatchNorm and LayerNorm. Default is O1(amp)
101101
dtype(str, optional): Whether to use 'float16' or 'bfloat16'. Default is 'float16'.
102102
master_weight(bool, optinal): For level='O2', whether to use multi-precision during weight updating. If master_weight is None, in O2 level optimizer will use multi-precision. Default is None.

python/paddle/fluid/framework.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ def xpu_places(device_ids=None):
932932

933933
def npu_places(device_ids=None):
934934
"""
935-
**Note**:
935+
936+
Note:
936937
For multi-card tasks, please use `FLAGS_selected_npus` environment variable to set the visible NPU device.
937938
938939
This function creates a list of :code:`paddle.NPUPlace` objects.

python/paddle/signal.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -266,30 +266,27 @@ def stft(
266266
windows of the input using this formula:
267267
268268
.. math::
269-
X_t[\omega] = \sum_{n = 0}^{N-1}%
269+
X_t[f] = \sum_{n = 0}^{N-1}%
270270
\text{window}[n]\ x[t \times H + n]\ %
271-
e^{-{2 \pi j \omega n}/{N}}
271+
e^{-{2 \pi j f n}/{N}}
272272
273273
Where:
274274
- :math:`t`: The :math:`t`-th input window.
275-
276-
- :math:`\omega`: Frequency :math:`0 \leq \omega < \text{n\_fft}` for `onesided=False`,
277-
or :math:`0 \leq \omega < \lfloor \text{n\_fft} / 2 \rfloor + 1` for `onesided=True`.
278-
275+
- :math:`f`: Frequency :math:`0 \leq f < \text{n_fft}` for `onesided=False`,
276+
or :math:`0 \leq f < \lfloor \text{n_fft} / 2 \rfloor + 1` for `onesided=True`.
279277
- :math:`N`: Value of `n_fft`.
280-
281278
- :math:`H`: Value of `hop_length`.
282279
283280
Args:
284281
x (Tensor): The input data which is a 1-dimensional or 2-dimensional Tensor with
285282
shape `[..., seq_length]`. It can be a real-valued or a complex Tensor.
286283
n_fft (int): The number of input samples to perform Fourier transform.
287284
hop_length (int, optional): Number of steps to advance between adjacent windows
288-
and `0 < hop_length`. Default: `None`(treated as equal to `n_fft//4`)
289-
win_length (int, optional): The size of window. Default: `None`(treated as equal
285+
and `0 < hop_length`. Default: `None` (treated as equal to `n_fft//4`)
286+
win_length (int, optional): The size of window. Default: `None` (treated as equal
290287
to `n_fft`)
291288
window (Tensor, optional): A 1-dimensional tensor of size `win_length`. It will
292-
be center padded to length `n_fft` if `win_length < n_fft`. Default: `None`(
289+
be center padded to length `n_fft` if `win_length < n_fft`. Default: `None` (
293290
treated as a rectangle window with value equal to 1 of size `win_length`).
294291
center (bool, optional): Whether to pad `x` to make that the
295292
:math:`t \times hop\_length` at the center of :math:`t`-th frame. Default: `True`.
@@ -438,39 +435,38 @@ def istft(
438435
Inverse short-time Fourier transform (ISTFT).
439436
440437
Reconstruct time-domain signal from the giving complex input and window tensor when
441-
nonzero overlap-add (NOLA) condition is met:
438+
nonzero overlap-add (NOLA) condition is met:
442439
443440
.. math::
444-
\sum_{t = -\infty}^{\infty}%
445-
\text{window}^2[n - t \times H]\ \neq \ 0, \ \text{for } all \ n
441+
\sum_{t = -\infty}^{\infty} \text{window}^2[n - t \times H]\ \neq \ 0, \ \text{for } all \ n
446442
447443
Where:
448444
- :math:`t`: The :math:`t`-th input window.
449445
- :math:`N`: Value of `n_fft`.
450446
- :math:`H`: Value of `hop_length`.
451447
452-
Result of `istft` expected to be the inverse of `paddle.signal.stft`, but it is
448+
Result of `istft` expected to be the inverse of `paddle.signal.stft`, but it is
453449
not guaranteed to reconstruct a exactly realizible time-domain signal from a STFT
454450
complex tensor which has been modified (via masking or otherwise). Therefore, `istft`
455-
gives the [Griffin-Lim optimal estimate](https://ieeexplore.ieee.org/document/1164317)
451+
gives the `[Griffin-Lim optimal estimate] <https://ieeexplore.ieee.org/document/1164317>`_
456452
(optimal in a least-squares sense) for the corresponding signal.
457453
458454
Args:
459455
x (Tensor): The input data which is a 2-dimensional or 3-dimensional **complesx**
460456
Tensor with shape `[..., n_fft, num_frames]`.
461457
n_fft (int): The size of Fourier transform.
462458
hop_length (int, optional): Number of steps to advance between adjacent windows
463-
from time-domain signal and `0 < hop_length < win_length`. Default: `None`(
459+
from time-domain signal and `0 < hop_length < win_length`. Default: `None` (
464460
treated as equal to `n_fft//4`)
465-
win_length (int, optional): The size of window. Default: `None`(treated as equal
461+
win_length (int, optional): The size of window. Default: `None` (treated as equal
466462
to `n_fft`)
467463
window (Tensor, optional): A 1-dimensional tensor of size `win_length`. It will
468464
be center padded to length `n_fft` if `win_length < n_fft`. It should be a
469465
real-valued tensor if `return_complex` is False. Default: `None`(treated as
470466
a rectangle window with value equal to 1 of size `win_length`).
471467
center (bool, optional): It means that whether the time-domain signal has been
472468
center padded. Default: `True`.
473-
normalized (bool, optional): Control whether to scale the output by `1/sqrt(n_fft)`.
469+
normalized (bool, optional): Control whether to scale the output by :math:`1/sqrt(n_fft)`.
474470
Default: `False`
475471
onesided (bool, optional): It means that whether the input STFT tensor is a half
476472
of the conjugate symmetry STFT tensor transformed from a real-valued signal
@@ -486,7 +482,7 @@ def istft(
486482
487483
Returns:
488484
A tensor of least squares estimation of the reconstructed signal(s) with shape
489-
`[..., seq_length]`
485+
`[..., seq_length]`
490486
491487
Examples:
492488
.. code-block:: python

python/paddle/tensor/linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3261,7 +3261,7 @@ def eigvalsh(x, UPLO='L', name=None):
32613261
complex Hermitian (conjugate symmetric) or a real symmetric matrix.
32623262
32633263
Args:
3264-
x (Tensor): A tensor with shape :math:`[_, M, M]` , The data type of the input Tensor x
3264+
x (Tensor): A tensor with shape :math:`[*, M, M]` , where * is zero or greater batch dimension. The data type of the input Tensor x
32653265
should be one of float32, float64, complex64, complex128.
32663266
UPLO(str, optional): Lower triangular part of a (‘L’, default) or the upper triangular part (‘U’).
32673267
name(str, optional): The default value is None. Normally there is no need for user to set this

python/paddle/tensor/random.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,14 +878,14 @@ def randint_like(x, low=0, high=None, dtype=None, name=None):
878878
If ``high`` is None (the default), the range is [0, ``low``).
879879
880880
Args:
881-
x (Tensor): The input tensor which specifies shape. The dtype of ``x``
881+
x (Tensor): The input multi-dimensional tensor which specifies shape. The dtype of ``x``
882882
can be bool, int32, int64, float16, float32, float64.
883883
low (int): The lower bound on the range of random values to generate.
884884
The ``low`` is included in the range. If ``high`` is None, the
885885
range is [0, ``low``). Default is 0.
886886
high (int, optional): The upper bound on the range of random values to
887-
generate, the ``high`` is excluded in the range. Default is None
888-
(see above for behavior if high = None). Default is None.
887+
generate, the ``high`` is excluded in the range. Default is None.
888+
If ``high`` is None, the range is [0, ``low``).
889889
dtype (str|np.dtype, optional): The data type of the
890890
output tensor. Supported data types: bool, int32, int64, float16,
891891
float32, float64. If ``dytpe`` is None, the data type is the

0 commit comments

Comments
 (0)