Since the network takes a mel-spectrogram as input, we will create an additional custom layer which can convert the raw audio wave to a spectrogram on-the-fly. We use the raw audio tensor from train_dataset and map it to a mel-spectrogram using the MelSpec layer below.