espnet2.enh.layers.beamformer.apply_beamforming_vector
Less than 1 minute
espnet2.enh.layers.beamformer.apply_beamforming_vector
espnet2.enh.layers.beamformer.apply_beamforming_vector(beamform_vector: Tensor | ComplexTensor, mix: Tensor | ComplexTensor) → Tensor | ComplexTensor
Apply the beamforming vector to the mixed signal.
This function computes the output signal by applying the provided beamforming vector to the mixed input signal. The operation essentially performs a weighted sum of the input channels using the beamforming vector.
- Parameters:
- beamform_vector (Union *[*torch.Tensor , ComplexTensor ]) – The beamforming vector of shape (…, C), where C is the number of channels.
- mix (Union *[*torch.Tensor , ComplexTensor ]) – The mixed input signal of shape (…, C, T), where T is the number of time steps.
- Returns: The output signal of shape (…, T), which is the result of applying the beamforming vector to the mixed signal.
- Return type: Union[torch.Tensor, ComplexTensor]
Examples
>>> import torch
>>> beamform_vector = torch.tensor([[1, 0], [0, 1]], dtype=torch.complex64)
>>> mix = torch.tensor([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], dtype=torch.complex64)
>>> output = apply_beamforming_vector(beamform_vector, mix)
>>> print(output)
tensor([[ 1.+0.j, 2.+0.j],
[ 5.+0.j, 6.+0.j]])