def retrieve_path_from_backpointers(bp, starting_point):
'''
Theano scan loop to follow backpointers, starting from a given spot.
Params
------
bp : The trail of backpointers. Think of this is as a list of
lists where we start from the back `bp = list[N][starting_point]` and
then go to list[N-1][bp] and so on.
starting_point :
'''
vp_prefix = th_reverse(
theano.scan(
lambda p, y: p[y],
sequences=bp,
outputs_info=starting_point,
go_backwards=True,
name='OrderOnePathMax_scan__bkpntr',
strict=True)[0])
return theano.tensor.concatenate([vp_prefix, starting_point.dimshuffle('x')])
lstm_seqlabel_circuit_order_one_crf_decode_and_partition.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录