Python keras.layers.core 模块,SpatialDropout1D() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用keras.layers.core.SpatialDropout1D()

项目:keras-customized    作者:ambrite    | 项目源码 | 文件源码
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))
项目:keras    作者:NVIDIA    | 项目源码 | 文件源码
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))
项目:keras    作者:GeekLiB    | 项目源码 | 文件源码
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))
项目:loss-correction    作者:giorgiop    | 项目源码 | 文件源码
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)
项目:loss-correction    作者:giorgiop    | 项目源码 | 文件源码
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)