def build_encoder_bi(tparams, options):
 embedding = tensor.tensor3('embedding', dtype='float32')
 embeddingr = embedding[::(-1)]
 x_mask = tensor.matrix('x_mask', dtype='float32')
 xr_mask = x_mask[::(-1)]
 proj = get_layer(options['encoder'])[1](tparams, embedding, options, prefix='encoder', mask=x_mask)
 projr = get_layer(options['encoder'])[1](tparams, embeddingr, options, prefix='encoder_r', mask=xr_mask)
 ctx = tensor.concatenate([proj[0][(-1)], projr[0][(-1)]], axis=1)
 return (embedding, x_mask, ctx)

def build_encoder_bi ( tparams , options ) : embedding = tensor . tensor3 ( 'embedding' , dtype = 'float32' ) embeddingr = embedding [ : : ( - 1 ) ] x_mask = tensor . matrix ( 'x_mask' , dtype = 'float32' ) xr_mask = x_mask [ : : ( - 1 ) ] proj = get_layer ( options [ 'encoder' ] ) [ 1 ] ( tparams , embedding , options , prefix = 'encoder' , mask = x_mask ) projr = get_layer ( options [ 'encoder' ] ) [ 1 ] ( tparams , embeddingr , options , prefix = 'encoder_r' , mask = xr_mask ) ctx = tensor . concatenate ( [ proj [ 0 ] [ ( - 1 ) ] , projr [ 0 ] [ ( - 1 ) ] ] , axis = 1 ) return ( embedding , x_mask , ctx )
build bidirectional encoder .