espnet2.enh.layers.beamformer.get_covariances
Less than 1 minute
espnet2.enh.layers.beamformer.get_covariances
espnet2.enh.layers.beamformer.get_covariances(Y: Tensor | ComplexTensor, inverse_power: Tensor, bdelay: int, btaps: int, get_vector: bool = False) → Tensor | ComplexTensor
Calculates the power normalized spatio-temporal covariance matrix of the framed signal.
Parameters:
- Y – Complex STFT signal with shape (B, F, C, T)
- inverse_power – Weighting factor with shape (B, F, T)
- bdelay (int) – Delay for WPD.
- btaps (int) – Number of taps.
- get_vector (bool) – If True, returns both the covariance matrix and the covariance vector.
Returns:
- Correlation matrix: (B, F, (btaps+1) * C, (btaps+1) * C) : - Correlation vector: (B, F, btaps + 1, C, C)
Otherwise, returns: : - Correlation matrix: (B, F, (btaps + 1) * C, (btaps + 1) * C)
Return type: If get_vector is True, returns
Raises:AssertionError – If inverse_power does not have 3 dimensions or its size does not match with Y.
Examples
>>> Y = torch.randn(2, 4, 3, 10, dtype=torch.complex64) # (B, F, C, T)
>>> inverse_power = torch.rand(2, 4, 10) # (B, F, T)
>>> cov_matrix = get_covariances(Y, inverse_power, bdelay=2, btaps=3)
>>> cov_matrix.shape
torch.Size([2, 4, 16, 16]) # (B, F, (btaps + 1) * C, (btaps + 1) * C)
>>> cov_matrix, cov_vector = get_covariances(Y, inverse_power,
... bdelay=2, btaps=3, get_vector=True)
>>> cov_vector.shape
torch.Size([2, 4, 4, 3, 3]) # (B, F, btaps + 1, C, C)
NOTE
- The bdelay and btaps parameters control the delay and the number of taps in the covariance calculation.