Skip to content

Conversation

@lixiaolei1982
Copy link

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

  • 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

@CLAassistant
Copy link

CLAassistant commented Nov 11, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in the tensor reshape operation where the incorrect variable was used for the width dimension when partitioning image patches into windows.

Changes:

  • Fixed variable name from num_h_patches_per_window to num_w_patches_per_window in the 4th dimension of the reshape operation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Borda Borda added the bug Something isn't working label Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants