def g(): return tf.func_capture(lambda: x)
def f(): cx = tf.func_capture(lambda: x) # Adding `b = tf.func_capture(lambda: x)` will generate two captures return cx + cx # should capture x just once.
def f(): cglob = tf.func_capture(lambda: glob) return cglob[-1] + tf.constant(0)
def f(): cd = tf.func_capture(lambda: d) return cd["val"]
def tf_g(): cx = tf.func_capture(lambda: x) return cx