Description:
When using a DataLoader that returns a tuple of (tensor, saliency_map) in __getitem__, and running head distillation with a teacher model (i.e., without bottleneck injection), the forward pass fails with the following error:
AttributeError: 'list' object has no attribute 'shape'
Cause:
The issue arises because the saliency-augmented input is not properly unpacked before being forwarded through the teacher model, which expects a plain tensor and not a tuple/list.
Traceback snippet:
File "patch_embed.py", line 50, in forward
B, C, H, W = x.shape
AttributeError: 'list' object has no attribute 'shape'
Steps to Reproduce:
- Use a dataset where
__getitem__ returns (tensor, saliency_map)
- Enable head distillation
- Train using a teacher model (no bottleneck injection)
Expected Behavior:
The teacher model should correctly receive just the tensor (not the tuple) in the forward pass.