def _spectrogram_mono(self, x):
        '''x.shape : (None, 1, len_src),
        returns 2D batch of a mono power-spectrogram'''
        x = K.permute_dimensions(x, [0, 2, 1])
        x = K.expand_dims(x, 3)  # add a dummy dimension (channel axis)
        subsample = (self.n_hop, 1)
        if self.padding == 'valid':
            x = tf.pad(x, [[0, 0], [self.n_dft - 1, 0], [0, 0], [0, 0]])
        output_real = K.conv2d(x, self.dft_real_kernels,
                               strides=subsample,
                               padding=self.padding,
                               data_format='channels_last')
        output_imag = K.conv2d(x, self.dft_imag_kernels,
                               strides=subsample,
                               padding=self.padding,
                               data_format='channels_last')
        output = output_real ** 2 + output_imag ** 2
        # now shape is (batch_sample, n_frame, 1, freq)
        if self.image_data_format == 'channels_last':
            output = K.permute_dimensions(output, [0, 1,3, 2])
        else:
            output = K.permute_dimensions(output, [0, 2, 1, 3])
        return output
x.shape : (None, 1, len_src),
        returns 2D batch of a mono power-spectrogram
asr/models/layers/time_frequency.py