# NotImplementedError: Gradient computation for while_loop is not supported when using symbolic execution

- **ID:** `tensorflow/not-implemented-while-loop-gradients`
- **Domain:** tensorflow
- **Category:** runtime_error
- **Error Code:** `WLE`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

While loops with gradients require autograph or explicit gradient tape; symbolic execution in TF1 graph mode cannot handle them.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| tensorflow 2.12.0 | active | — | — |
| tensorflow 2.15.0 | active | — | — |

## Workarounds

1. **Use tf.while_loop with back_prop=True inside a tf.function decorated with autograph: @tf.function; def train_step(): ...** (85% success)
   ```
   Use tf.while_loop with back_prop=True inside a tf.function decorated with autograph: @tf.function; def train_step(): ...
   ```
2. **Replace while_loop with vectorized operations using tf.map_fn or tf.scan.** (75% success)
   ```
   Replace while_loop with vectorized operations using tf.map_fn or tf.scan.
   ```

## Dead Ends

- **** — Adding more GPU memory doesn't fix the algorithmic limitation. (90% fail)
- **** — Disabling eager mode makes symbolic execution worse. (80% fail)
