(gate_type, embeddings_size, decoder_size,
                         attention_size, output_size)
return gate_types[gate_type](embeddings_size, decoder_size, attention_size,
                                 output_size)
Returns the correct ContextGate class
Returns the correct ContextGate class
Returns the correct ContextGate class
def context_gate_factory(gate_type, embeddings_size, decoder_size,
                         attention_size, output_size):
    """Returns the correct ContextGate class"""

    gate_types = {'source': SourceContextGate,
                  'target': TargetContextGate,
                  'both': BothContextGate}

    assert gate_type in gate_types, "Not valid ContextGate type: {0}".format(
        gate_type)
    return gate_types[gate_type](embeddings_size, decoder_size, attention_size,
                                 output_size)
def context_gate_factory ( gate_type , embeddings_size , decoder_size , attention_size , output_size ) : gate_types = { 'source' : SourceContextGate , 'target' : TargetContextGate , 'both' : BothContextGate } assert gate_type in gate_types , "Not valid ContextGate type: {0}" . format ( gate_type ) return gate_types [ gate_type ] ( embeddings_size , decoder_size , attention_size , output_size )