code: def test_single_channel_model(
      label_aggregator,
      frontend,
      encoder,
      decoder,
      attractor,
      training,
  ):
      inputs = torch.randn(2, 300)
      ilens = torch.LongTensor([300, 200])
      spk_labels = torch.randint(high=2, size=(2, 300, 2))
      diar_model = ESPnetDiarizationModel(
          label_aggregator=label_aggregator,
          attractor=attractor,
          encoder=encoder,
          decoder=decoder,
          frontend=frontend,
          specaug=None,
          normalize=None,
      )
  
      if training:
          diar_model.train()
      else:
          diar_model.eval()
  
      kwargs = {
          "speech": inputs,
          "speech_lengths": ilens,
          "spk_labels": spk_labels,
          "spk_labels_lengths": ilens,
      }
      loss, stats, weight = diar_model(**kwargs)
  
file_path: espnet/test/espnet2/diar/test_espnet_model.py
imports: import pytest
  import torch
  from espnet2.asr.encoder.transformer_encoder import TransformerEncoder
  from espnet2.asr.frontend.default import DefaultFrontend
  from espnet2.diar.attractor.rnn_attractor import RnnAttractor
  from espnet2.diar.decoder.linear_decoder import LinearDecoder
  from espnet2.diar.espnet_model import ESPnetDiarizationModel
  from espnet2.layers.label_aggregation import LabelAggregate
label_desc: Use image node_id 1 for calling a global function with example usage: test_single_channel_model(label_aggregator, frontend, encoder, decoder, attractor, training) without return types