def test_tiny_mcrnn_music_tagger(self):
x_in = Input(shape=(4,6,1))
x = ZeroPadding2D(padding=(0, 1))(x_in)
x = BatchNormalization(axis=2, name='bn_0_freq')(x)
# Conv block 1
x = Conv2D(2, (3, 3), padding='same', name='conv1')(x)
x = BatchNormalization(axis=3, name='bn1')(x)
x = Activation('elu')(x)
x = MaxPooling2D(pool_size=(2, 2), strides=(2, 2), name='pool1')(x)
# Conv block 2
x = Conv2D(4, (3, 3), padding='same', name='conv2')(x)
x = BatchNormalization(axis=3, name='bn2')(x)
x = Activation('elu')(x)
x = MaxPooling2D(pool_size=(2, 2), strides=(2, 2), name='pool2')(x)
# Should get you (1,1,2,4)
x = Reshape((2, 4))(x)
x = GRU(32, return_sequences=True, name='gru1')(x)
x = GRU(32, return_sequences=False, name='gru2')(x)
# Create model.
model = Model(x_in, x)
model.set_weights([np.random.rand(*w.shape) for w in model.get_weights()])
self._test_keras_model(model, mode='random_zero_mean', delta=1e-2)
评论列表
文章目录