Files
Liger-Kernel/src/liger_kernel
aryan d8d6630e5c fix: guard save_for_backward on grad_bias not bias in fused linear CE forward (#1157)
## Summary
Fixes a bug in `LigerFusedLinearCrossEntropyFunction.forward` where
`ctx.save_for_backward` checks `bias is not None` instead of `grad_bias
is not None` before calling `.detach()`.

When `input_requires_grad=False`, `fused_linear_cross_entropy_forward`
sets `grad_bias = None` regardless of whether `bias` is provided. The
stale check then calls `None.detach()` and raises `AttributeError`.

Fixes #1156

## Details
One-line fix in `src/liger_kernel/ops/fused_linear_cross_entropy.py`:

Before: `grad_bias.detach() if bias is not None else None,`
After:  `grad_bias.detach() if grad_bias is not None else None,`

## Testing Done
- Hardware Type: CPU (logic-only fix, no GPU kernel change)
- [x] run `make test` to ensure correctness
- [x] run `make checkstyle` to ensure code style
- [ ] run `make test-convergence` to ensure convergence
2026-03-23 12:57:46 +00:00
..
2024-11-22 20:03:06 -08:00