espnet2.enh.layers.fasnet.test_model
Less than 1 minute
espnet2.enh.layers.fasnet.test_model
espnet2.enh.layers.fasnet.test_model(model)
Test the given model with random input data.
This function generates random input data to test the functionality of the provided model. It creates a batch of audio signals with a specified number of microphones and verifies the output shape of the model for both variable and fixed microphone configurations.
- Parameters:model (nn.Module) – The model to be tested, which should implement a forward method that accepts input data and the number of active microphones.
Examples
>>> model_TAC = FaSNet_TAC(
... enc_dim=64,
... feature_dim=64,
... hidden_dim=128,
... layer=4,
... segment_size=50,
... nspk=2,
... win_len=4,
... context_len=16,
... sr=16000,
... )
>>> test_model(model_TAC)
torch.Size([2, 2, 32000]) torch.Size([2, 2, 32000])
NOTE
The input tensor x is generated with a shape of (batch, num_mic, length), where batch is set to 2, num_mic is set to 4, and length is set to 32000. The num_mic tensor is created as an ad-hoc array representing the number of active microphones for each batch element.
- Raises:AssertionError – If the model’s output shape does not match the expected dimensions.