8cdbb1637b140c01f431831e7b2c2a63afc96209,kapre/time_frequency.py,Melspectrogram,call,#Melspectrogram#Any#,328

Before Change


            return input_shape[0], self.n_mels, self.n_frame, self.n_ch

    def call(self, x):
        power_spectrogram = super(Melspectrogram, self).call(x)
        // now,  channels_first: (batch_sample, n_ch, n_freq, n_time)
        //       channels_last: (batch_sample, n_freq, n_time, n_ch)
        if self.image_data_format == "channels_first":
            power_spectrogram = K.permute_dimensions(power_spectrogram, [0, 1, 3, 2])
        else:
            power_spectrogram = K.permute_dimensions(power_spectrogram, [0, 3, 2, 1])
        // now, whatever image_data_format, (batch_sample, n_ch, n_time, n_freq)
        output = K.dot(power_spectrogram, self.freq2mel)
        if self.image_data_format == "channels_first":
            output = K.permute_dimensions(output, [0, 1, 3, 2])
        else:
            output = K.permute_dimensions(output, [0, 3, 2, 1])
        if self.power_melgram != 2.0:
            output = K.pow(K.sqrt(output), self.power_melgram)
        if self.return_decibel_melgram:
            output = backend_keras.amplitude_to_decibel(output)
        return output

    def get_config(self):
        config = {

After Change


            x = K.permute_dimensions(x, (0, 2, 3, 1))

        x = tf.pad(
            x, tf.constant([[0, 0], [self.n, self.n], [0, 0], [0, 0]]), mode=self.mode
        )  // pad over time
        kernel = K.arange(-self.n, self.n + 1, 1, dtype=K.floatx())
        kernel = K.reshape(kernel, (-1, 1, 1, 1))  // time, freq, in_ch, out_ch

        x = K.conv2d(x, kernel, data_format="channels_last") / self.denom
        if self.data_format == "channels_first":
            x = K.permute_dimensions(x, (0, 3, 1, 2))

        return x

    def get_config(self):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: keunwoochoi/kapre
Commit Name: 8cdbb1637b140c01f431831e7b2c2a63afc96209
Time: 2020-08-14
Author: gnuchoi+github@gmail.com
File Name: kapre/time_frequency.py
Class Name: Melspectrogram
Method Name: call


Project Name: explosion/spaCy
Commit Name: b10173655589b038ba1e69e937eddf03819dc94d
Time: 2017-10-20
Author: honnibal+gh@gmail.com
File Name: spacy/_ml.py
Class Name: PrecomputableAffine
Method Name: begin_update


Project Name: geomstats/geomstats
Commit Name: 15de53212565c6d8fda59f30258d69d67eed183f
Time: 2018-12-12
Author: ninamio78@gmail.com
File Name: tests/test_euclidean_space.py
Class Name: TestEuclideanSpaceMethods
Method Name: test_inner_product


Project Name: geomstats/geomstats
Commit Name: 2dfa1664abf933b6188f325b127e9687d057d5da
Time: 2018-12-12
Author: ninamio78@gmail.com
File Name: tests/test_euclidean_space.py
Class Name: TestEuclideanSpaceMethods
Method Name: test_squared_dist_vectorization