def __call__(self, x, m=None, h0s=None, condition_on=None):
'''Call function.
For learning RNNs.
Args:
x (T.tensor): input sequence. window x batch x dim
m (T.tensor): mask. window x batch. For masking in recurrent steps.
h0s (Optional[list]): initial h0s.
condition_on (Optional[T.tensor]): conditional for recurrent step.
Returns:
OrderedDict: dictionary of results: hiddens, probabilities, and
preacts.
theano.OrderedUpdates.
'''
if h0s is None:
h0s = [T.alloc(0., x.shape[1], dim_h).astype(floatX) for dim_h in self.dim_hs]
if m is None:
m = T.ones((x.shape[0], x.shape[1])).astype(floatX)
params = self.get_sample_params()
return self.step_call(x, m, h0s, *params)
评论列表
文章目录