()
| 117 | |
| 118 | @def_function.function |
| 119 | def fnWithLoop(): # pylint: disable=invalid-name |
| 120 | with backprop.GradientTape() as tape: |
| 121 | _, x = while_loop_v2( |
| 122 | lambda i, _: i < 2, |
| 123 | lambda i, x: (i + 1, x * v), |
| 124 | [0, 2.]) |
| 125 | return tape.gradient(x, v) |
| 126 | |
| 127 | self.assertAllEqual(fnWithLoop(), 4.0) |
| 128 |
nothing calls this directly
no test coverage detected