def shape(self): (Wh, ) = self.limits[1] d = Wh.shape[-1] / 3 if len(self.limits) > 3: return (d, ) x = self.arg x_shape = x.shape shape = (x_shape[-2], d) if len(x_shape) > 2: shape = (x[0], ) + shape return shape gru = Function.gru(real=True, eval=gru_recursive, shape=property(shape)) def GRU(x, *limits): (Wx, ), (Wh, ), (b, ) = limits n = x.shape[0] t = Symbol.t(integer=True) return Lamda[t:n](gru[Wx, Wh, b, t](x)) assert shape.__name__ == 'shape' GRU = Function.GRU(real=True, eval=GRU, shape=property(shape))