Fix incomplete activation validation in HausdorffDTLoss#8841
Fix incomplete activation validation in HausdorffDTLoss#8841aymuos15 wants to merge 2 commits intoProject-MONAI:devfrom
Conversation
The validation check for mutually exclusive activation options was
incomplete - it only checked sigmoid and softmax but not other_act,
despite the error message explicitly mentioning other_act.
Before:
```python
if int(sigmoid) + int(softmax) > 1:
raise ValueError("... [sigmoid=True, softmax=True, other_act is not None].")
```
After:
```python
if int(sigmoid) + int(softmax) + int(other_act is not None) > 1:
raise ValueError("... [sigmoid=True, softmax=True, other_act is not None].")
```
This is consistent with the validation in dice.py and tversky.py which
correctly include all three options in the check.
Added tests for:
- sigmoid=True with other_act
- softmax=True with other_act
- All three options combined
Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change enhances validation in Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
The validation check for mutually exclusive activation options was incomplete - it only checked sigmoid and softmax but not other_act, despite the error message explicitly mentioning other_act.
Without this check, passing e.g.
sigmoid=True, other_act=relusilently stacks both activations inforward()(other_act(sigmoid(x))) instead of applying only one, producing an incorrect loss with no warning.Before:
After:
This is consistent with the validation in dice.py and tversky.py which correctly include all three options in the check.
Added tests for:
Types of changes