Esempio n. 1
0
 def while_compute(x):
     return control_flow_ops.while_loop_v2(
         lambda i, _: i < 10, lambda i, y:
         (i + 1, y + vectorized_compute(x, i)),
         (0, array_ops.zeros([5, 1])))[1]
 def g(x):
   return control_flow_ops.while_loop_v2(
       lambda *_: True,
       lambda y, shp: (y + random_ops.random_normal(shp)**2, shp),
       (x, array_ops.shape(x)),
       maximum_iterations=3)[0]
 def outer(y, shp):
   y, shp = control_flow_ops.while_loop_v2(
       lambda *_: True, inner, (y, shp), maximum_iterations=3)
   y, shp = array_ops.identity_n([y, shp])
   return control_flow_ops.while_loop_v2(
       lambda *_: True, inner, (y, shp), maximum_iterations=5)
 def outer(y, shp):
   y, shp = control_flow_ops.while_loop_v2(
       lambda *_: True, inner, (y, shp), maximum_iterations=3)
   return control_flow_ops.while_loop_v2(
       lambda *_: True, inner, (y, shp), maximum_iterations=4)