rf-detr icon indicating copy to clipboard operation
rf-detr copied to clipboard

fix: correct variable name in pixel_tokens_with_pos_embed reshape operation

Open lixiaolei1982 opened this issue 1 month ago • 1 comments

Description

Fixed incorrect variable name in pixel_tokens_with_pos_embed reshaping operation where num_h_patches_per_window was used instead of num_w_patches_per_window for the width dimension.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

Changes Made

  • Change: num_h_patches_per_windownum_w_patches_per_window in the fourth dimension of reshape operation
  • File: rfdetr/models/backbone/dinov2_with_windowed_attn.py
  • Line: ~315

Code Comparison

Before:

windowed_pixel_tokens = pixel_tokens_with_pos_embed.reshape(
    batch_size * num_windows, num_h_patches_per_window, 
    num_windows, num_h_patches_per_window, -1)

**After:**
```python
windowed_pixel_tokens = pixel_tokens_with_pos_embed.reshape(
    batch_size * num_windows, num_h_patches_per_window, 
    num_windows, num_w_patches_per_window, -1)

## Impact
- Improves code readability and consistency
- No functional changes

lixiaolei1982 avatar Nov 11 '25 13:11 lixiaolei1982

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 11 '25 13:11 CLAassistant