vak.transforms.functional.add_channel#

vak.transforms.functional.add_channel(input, channel_dim=0)[source]#

Add a “channel” dimension to a tensor.

Transform that makes it easy to treat a spectrogram as an image, by adding a dimension with a single ‘channel’, analogous to grayscale. In this way the tensor can be fed to e.g. convolutional layers.

Parameters:
  • input (torch.Tensor) –

  • channel_dim (int) – dimension where “channel” is added. Default is 0.