espnet2.enh.layers.wpe.get_power
Less than 1 minute
espnet2.enh.layers.wpe.get_power
espnet2.enh.layers.wpe.get_power(signal, dim=-2) → Tensor
Calculates power for a given signal.
The power is calculated as the mean of the squared real and imaginary parts of the signal across the specified dimension.
- Parameters:
- signal (Union *[*torch.Tensor , ComplexTensor ]) – Single frequency signal with shape (F, C, T), where F is the number of frequency bins, C is the number of channels, and T is the number of time steps.
- dim (int , optional) – The dimension along which to compute the mean. Defaults to -2.
- Returns: Power with shape (F, T), representing the average power of the signal across the specified dimension.
- Return type: torch.Tensor
Examples
>>> signal = torch.tensor([[[1, 2, 3], [4, 5, 6]], [[1, 1, 1], [1, 1, 1]]])
>>> power = get_power(signal)
>>> print(power)
tensor([[ 4.5000, 5.5000, 6.5000],
[ 1.0000, 1.0000, 1.0000]])