test_keras2_numeric.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:coremltools 作者: apple 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号