Пример #1
0
 def f(x, init_key=None):
     y = module.variable(np.zeros(x.shape), name='y', key=init_key)
     next_y = module.assign(y + 1., name='y')
     return primitive.tie_in(next_y, x) + y
Пример #2
0
 def f(x, init_key=None):
     y = module.variable(np.zeros(x.shape), name='y', key=init_key)
     next_y = module.assign(y + 1., name='z')
     return x + next_y