deeppavlov/models/morpho_tagger/cells.py
def TemporalDropout(inputs, dropout=0.0):
    """
    Drops with :dropout probability temporal steps of input 3D tensor
    """
    # TO DO: adapt for >3D tensors
    if dropout == 0.0:
        return inputs
    inputs_func = lambda x: kb.ones_like(inputs[:, :, 0:1])
    inputs_mask = kl.Lambda(inputs_func)(inputs)
    inputs_mask = kl.Dropout(dropout)(inputs_mask)
    tiling_shape = [1, 1, kb.shape(inputs)[2]] + [1] * (kb.ndim(inputs) - 3)
    inputs_mask = kl.Lambda(kb.tile, arguments={"n": tiling_shape},
                            output_shape=inputs._keras_shape[1:])(inputs_mask)
    answer = kl.Multiply()([inputs, inputs_mask])
    return answer
def TemporalDropout(inputs, dropout=0.0):
    """
    Drops with :dropout probability temporal steps of input 3D tensor
    """
    # TO DO: adapt for >3D tensors
    if dropout == 0.0:
        return inputs
    inputs_func = lambda x: kb.ones_like(inputs[:, :, 0:1])
    inputs_mask = kl.Lambda(inputs_func)(inputs)
    inputs_mask = kl.Dropout(dropout)(inputs_mask)
    tiling_shape = [1, 1, kb.shape(inputs)[2]] + [1] * (kb.ndim(inputs) - 3)
    inputs_mask = kl.Lambda(kb.tile, arguments={"n": tiling_shape},
                            output_shape=inputs._keras_shape[1:])(inputs_mask)
    answer = kl.Multiply()([inputs, inputs_mask])
    return answer
def TemporalDropout ( inputs , dropout = 0.0 ) : # TO DO: adapt for >3D tensors if dropout == 0.0 : return inputs inputs_func = lambda x : kb . ones_like ( inputs [ : , : , 0 : 1 ] ) inputs_mask = kl . Lambda ( inputs_func ) ( inputs ) inputs_mask = kl . Dropout ( dropout ) ( inputs_mask ) tiling_shape = [ 1 , 1 , kb . shape ( inputs ) [ 2 ] ] + [ 1 ] * ( kb . ndim ( inputs ) - 3 ) inputs_mask = kl . Lambda ( kb . tile , arguments = { "n" : tiling_shape } , output_shape = inputs . _keras_shape [ 1 : ] ) ( inputs_mask ) answer = kl . Multiply ( ) ( [ inputs , inputs_mask ] ) return answer
Drops with :dropout probability temporal steps of input 3D tensor
Drops with : dropout probability temporal steps of input 3D tensor