mindspore.dataset.audio.Angle

查看源文件
class mindspore.dataset.audio.Angle[源代码]

计算复数序列的角度。

说明

待处理音频shape需为<…, complex=2>。第零维代表实部,第一维代表虚部。

异常:
  • RuntimeError - 当输入音频的shape不为<…, complex=2>。

支持平台:

CPU

样例:

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.audio as audio
>>>
>>> # Use the transform in dataset pipeline mode
>>> waveform = np.random.random([5, 16, 2])  # 5 samples
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.Angle()]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
>>> for item in numpy_slices_dataset.create_dict_iterator(num_epochs=1, output_numpy=True):
...     print(item["audio"].shape, item["audio"].dtype)
...     break
(16,) float64
>>>
>>> # Use the transform in eager mode
>>> waveform = np.random.random([16, 2])  # 1 sample
>>> output = audio.Angle()(waveform)
>>> print(output.shape, output.dtype)
(16,) float64
教程样例: