python类SpatialDropout1D()的实例源码

test_core.py 文件源码 项目:keras-customized 作者: ambrite 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def test_dropout():
    layer_test(core.Dropout,
               kwargs={'p': 0.5},
               input_shape=(3, 2))

    layer_test(core.SpatialDropout1D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4))

    layer_test(core.SpatialDropout2D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5))

    layer_test(core.SpatialDropout3D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5, 6))
test_core.py 文件源码 项目:keras 作者: NVIDIA 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def test_dropout():
    layer_test(core.Dropout,
               kwargs={'p': 0.5},
               input_shape=(3, 2))

    layer_test(core.Dropout,
               kwargs={'p': 0.5, 'noise_shape': [3, 1]},
               input_shape=(3, 2))

    layer_test(core.SpatialDropout1D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4))

    layer_test(core.SpatialDropout2D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5))

    layer_test(core.SpatialDropout3D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5, 6))
test_core.py 文件源码 项目:keras 作者: GeekLiB 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_dropout():
    layer_test(core.Dropout,
               kwargs={'p': 0.5},
               input_shape=(3, 2))

    layer_test(core.SpatialDropout1D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4))

    layer_test(core.SpatialDropout2D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5))

    layer_test(core.SpatialDropout3D,
               kwargs={'p': 0.5},
               input_shape=(2, 3, 4, 5, 6))
models.py 文件源码 项目:loss-correction 作者: giorgiop 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def build_model(self, loss, P=None):

        input = Input(shape=(self.maxlen,))

        x = Embedding(self.max_features, self.embedding_dims)(input)
        x = SpatialDropout1D(0.8)(x)
        x = Activation('relu')(x)

        x = Flatten()(x)
        output = Dense(self.classes, kernel_initializer='he_normal')(x)

        if loss in yes_bound:
            output = BatchNormalization(axis=1)(output)

        if loss in yes_softmax:
            output = Activation('softmax')(output)

        model = Model(inputs=input, outputs=output)
        self.compile(model, loss, P)
models.py 文件源码 项目:loss-correction 作者: giorgiop 项目源码 文件源码 阅读 91 收藏 0 点赞 0 评论 0
def build_model(self, loss, P=None):

        input = Input(shape=(self.maxlen,))

        x = Embedding(self.max_features, self.embedding_dims)(input)
        x = SpatialDropout1D(0.8)(x)

        x = LSTM(self.lstm_dim, kernel_initializer='uniform')(x)

        x = Dense(self.embedding_dims, kernel_initializer='he_normal')(x)
        x = Dropout(0.5)(x)
        x = Activation('relu')(x)

        output = Dense(self.classes, kernel_initializer='he_normal')(x)

        if loss in yes_bound:
            output = BatchNormalization(axis=1)(output)

        if loss in yes_softmax:
            output = Activation('softmax')(output)

        model = Model(inputs=input, outputs=output)
        self.compile(model, loss, P)


问题


面经


文章

微信
公众号

扫码关注公众号