# InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [100,256] rhs shape= [200,256]

- **ID:** `tensorflow/checkpoint-incompatible-shape`
- **Domain:** tensorflow
- **Category:** runtime_error
- **Error Code:** `CIS`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to restore a checkpoint into a model whose layer shapes differ from the saved checkpoint due to model architecture changes.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| tensorflow 2.10 | active | — | — |
| tensorflow 2.11 | active | — | — |
| tensorflow 2.12 | active | — | — |

## Workarounds

1. **Modify the model to match the checkpoint shapes. For example, if the checkpoint has a Dense layer with 256 units but your model has 200 units, change to 256: model.add(tf.keras.layers.Dense(256)). Then restore: model.load_weights('path/to/checkpoint').** (85% success)
   ```
   Modify the model to match the checkpoint shapes. For example, if the checkpoint has a Dense layer with 256 units but your model has 200 units, change to 256: model.add(tf.keras.layers.Dense(256)). Then restore: model.load_weights('path/to/checkpoint').
   ```
2. **Use load_weights with by_name=True and skip_mismatch=True to load only matching layers: model.load_weights('path/to/checkpoint', by_name=True, skip_mismatch=True)** (75% success)
   ```
   Use load_weights with by_name=True and skip_mismatch=True to load only matching layers: model.load_weights('path/to/checkpoint', by_name=True, skip_mismatch=True)
   ```

## Dead Ends

- **Deleting and recreating the checkpoint file** — The checkpoint is valid; the problem is the model definition mismatch. Deleting the checkpoint loses training progress without addressing the root cause. (90% fail)
- **Changing learning rate or optimizer** — The error is about tensor shape mismatch during assignment, not optimization hyperparameters. (99% fail)
