class_docstr: A dataset for audio-to-audio tasks where the goal is to use
  an input signal to recover the corresponding target signal and an
  additional reference signal is available.
  
  This can be used, for example, when a reference signal is
  available from
  - enrollment utterance for the target signal
  - echo reference from playback
  - reference from another sensor that correlates with the target signal
  
  Each line of the manifest file is expected to have the following format
      ```
      {
          'input_key': 'path/to/input.wav',
          'target_key': 'path/to/path_to_target.wav',
          'reference_key': 'path/to/path_to_reference.wav',
          'duration': duration_of_input,
      }
      ```
  
  Keys for input, target and reference signals can be configured in the constructor.
  
  Args:
      manifest_filepath: Path to manifest file in a format described above.
      sample_rate: Sample rate for loaded audio signals.
      input_key: Key pointing to input audio files in the manifest
      target_key: Key pointing to target audio files in manifest
      reference_key: Key pointing to reference audio files in manifest
      audio_duration: Optional duration of each item returned by __getitem__.
                      If `None`, complete audio will be loaded.
                      If set, a random subsegment will be loaded synchronously from
                      target and audio, i.e., with the same start and end point.
      random_offset: If `True`, offset will be randomized when loading a subsegment
                     from a file.
      max_duration: If audio exceeds this length, do not include in dataset.
      min_duration: If audio is less than this length, do not include in dataset.
      max_utts: Limit number of utterances.
      input_channel_selector: Optional, select subset of channels from each input audio file.
                              If `None`, all channels will be loaded.
      target_channel_selector: Optional, select subset of channels from each input audio file.
                               If `None`, all channels will be loaded.
      reference_channel_selector: Optional, select subset of channels from each input audio file.
                                  If `None`, all channels will be loaded.
      reference_is_synchronized: If True, it is assumed that the reference signal is synchronized
                                 with the input signal, so the same subsegment will be loaded as for
                                 input and target. If False, reference signal will be loaded independently
                                 from input and target.
      reference_duration: Optional, can be used to set a fixed duration of the reference utterance. If `None`,
                          complete audio file will be loaded.
class_docstr_tok: ["A","dataset","for","audio-to-audio","tasks","where","the","goal","is","to","use","an","input","signal","to","recover","the","corresponding","target","signal","and","an","additional","reference","signal","is","available",".","This","can","be","used",",","for","example",",","when","a","reference","signal","is","available","from","-","enrollment","utterance","for","the","target","signal","-","echo","reference","from","playback","-","reference","from","another","sensor","that","correlates","with","the","target","signal","Each","line","of","the","manifest","file","is","expected","to","have","the","following","format","``","`","{","'input_key","'",":","'path\/to\/input.wav","'",",","'target_key","'",":","'path\/to\/path_to_target.wav","'",",","'reference_key","'",":","'path\/to\/path_to_reference.wav","'",",","'duration","'",":","duration_of_input",",","}","``","`","Keys","for","input",",","target","and","reference","signals","can","be","configured","in","the","constructor",".","Args",":","manifest_filepath",":","Path","to","manifest","file","in","a","format","described","above",".","sample_rate",":","Sample","rate","for","loaded","audio","signals",".","input_key",":","Key","pointing","to","input","audio","files","in","the","manifest","target_key",":","Key","pointing","to","target","audio","files","in","manifest","reference_key",":","Key","pointing","to","reference","audio","files","in","manifest","audio_duration",":","Optional","duration","of","each","item","returned","by","__getitem__",".","If","`","None","`",",","complete","audio","will","be","loaded",".","If","set",",","a","random","subsegment","will","be","loaded","synchronously","from","target","and","audio",",","i.e.",",","with","the","same","start","and","end","point",".","random_offset",":","If","`","True","`",",","offset","will","be","randomized","when","loading","a","subsegment","from","a","file",".","max_duration",":","If","audio","exceeds","this","length",",","do","not","include","in","dataset",".","min_duration",":","If","audio","is","less","than","this","length",",","do","not","include","in","dataset",".","max_utts",":","Limit","number","of","utterances",".","input_channel_selector",":","Optional",",","select","subset","of","channels","from","each","input","audio","file",".","If","`","None","`",",","all","channels","will","be","loaded",".","target_channel_selector",":","Optional",",","select","subset","of","channels","from","each","input","audio","file",".","If","`","None","`",",","all","channels","will","be","loaded",".","reference_channel_selector",":","Optional",",","select","subset","of","channels","from","each","input","audio","file",".","If","`","None","`",",","all","channels","will","be","loaded",".","reference_is_synchronized",":","If","True",",","it","is","assumed","that","the","reference","signal","is","synchronized","with","the","input","signal",",","so","the","same","subsegment","will","be","loaded","as","for","input","and","target",".","If","False",",","reference","signal","will","be","loaded","independently","from","input","and","target",".","reference_duration",":","Optional",",","can","be","used","to","set","a","fixed","duration","of","the","reference","utterance",".","If","`","None","`",",","complete","audio","file","will","be","loaded","."]
docstr: Returns definitions of module output ports.
  
  Returns:
      Ordered dictionary in the following form:
      ```
      {
          'input_signal': batched single- or multi-channel format,
          'input_length': batched original length of each input signal
          'target_signal': batched single- or multi-channel format,
          'target_length': batched original length of each target signal
          'reference_signal': single- or multi-channel format,
          'reference_length': original length of each reference signal
      }
      ```
code: def output_types(self) -> Optional[Dict[str, NeuralType]]:
      """Returns definitions of module output ports.
  
      Returns:
          Ordered dictionary in the following form:
          ```
          {
              'input_signal': batched single- or multi-channel format,
              'input_length': batched original length of each input signal
              'target_signal': batched single- or multi-channel format,
              'target_length': batched original length of each target signal
              'reference_signal': single- or multi-channel format,
              'reference_length': original length of each reference signal
          }
          ```
      """
      sc_audio_type = NeuralType(("B", "T"), AudioSignal())
      mc_audio_type = NeuralType(("B", "C", "T"), AudioSignal())
  
      return OrderedDict(
          input_signal=sc_audio_type
          if self.num_channels("input_signal") == 1
          else mc_audio_type,
          input_length=NeuralType(("B",), LengthsType()),
          target_signal=sc_audio_type
          if self.num_channels("target_signal") == 1
          else mc_audio_type,
          target_length=NeuralType(("B",), LengthsType()),
          reference_signal=sc_audio_type
          if self.num_channels("reference_signal") == 1
          else mc_audio_type,
          reference_length=NeuralType(("B",), LengthsType()),
      )
  
imports: import abc
  import math
  import random
  from collections import OrderedDict, namedtuple
  from dataclasses import dataclass
  from typing import Callable, Dict, List, Optional, Tuple, Type, Union
  import librosa
  import numpy
  import torch
  from nemo.collections.asr.parts.preprocessing.segment import AudioSegment
  from nemo.collections.asr.parts.utils.audio_utils import ChannelSelectorType
  from nemo.collections.common.parts.preprocessing import collections
  from nemo.collections.common.parts.utils import flatten
  from nemo.core.classes import Dataset
  from nemo.core.neural_types import AudioSignal, EncodedRepresentation, LengthsType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling the AudioToTargetWithReferenceDataset obj's underlying member method code with example usage: obj.output_types() and returns: OrderedDict