def forward_all(self, x, masks = None, h0=None, return_c=False, direction = None):
if h0 is None:
if x.ndim > 1:
h0 = T.zeros((x.shape[1], self.n_out*(self.order+1)), dtype=theano.config.floatX)
else:
h0 = T.zeros((self.n_out*(self.order+1),), dtype=theano.config.floatX)
if masks == None:
masks = T.ones((x.shape[0], x.shape[1]), dtype = theano.config.floatX)
h, _ = theano.scan(
fn = self.forward,
sequences = [x, masks],
outputs_info = [ h0 ]
)
if return_c:
return h
elif x.ndim > 1:
return h[:,:,self.n_out*self.order:]
else:
return h[:,self.n_out*self.order:]
advanced.py 文件源码
python
阅读 37
收藏 0
点赞 0
评论 0
评论列表
文章目录