vak.transforms.transforms.AddChannel#
- class vak.transforms.transforms.AddChannel(channel_dim: int | float = 0)[source]#
Bases:
object
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) – with two dimensions (height, width).
channel_dim (int) – dimension where “channel” is added. Default is 0, which returns a tensor with dimensions (channel, height, width).
Methods
__init__
([channel_dim])