mindspore.dataset.audio.ComplexNorm

View Source On Gitee
class mindspore.dataset.audio.ComplexNorm(power=1.0)[source]

Compute the norm of complex number sequence.

Note

The shape of the audio waveform to be processed needs to be <…, complex=2>. The first dimension represents the real part while the second represents the imaginary.

Parameters

power (float, optional) – Power of the norm, which must be non-negative. Default: 1.0.

Raises
  • TypeError – If power is not of type float.

  • ValueError – If power is a negative number.

  • RuntimeError – If input tensor is not in shape of <…, complex=2>.

Supported Platforms:

CPU

Examples

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.audio as audio
>>>
>>> waveform = np.random.random([2, 4, 2])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.ComplexNorm()]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
Tutorial Examples: