Skip to content

Several runtime bugs in SFM_fpn.py (MSLPRM_efficient / LPRM_efficient) #5

Description

@Limyuul

While running the standalone demo in SFM_fpn.py, several small runtime
issues were encountered. This report summarizes the problems and may
help improve robustness of the implementation.


1. NameError: dilation is not defined in MSLPRM_efficient.__init__

In the constructor of MSLPRM_efficient, the following block produces
an error:

padding=dilation * (kernel_size // 2)  # 'dilation' is not defined here

The correct variable appears to be dilations[i].
This leads to:

NameError: name 'dilation' is not defined. Did you mean: 'dilations'?

2. Incorrect Iteration Over ModuleList Objects

The loop:

for (lpr_conv, lprm) in (self.lpr_convs, self.lpr_modules):

attempts to unpack two ModuleLists into layer‑wise pairs, causing:

ValueError: too many values to unpack (expected 2)

A corrected version should explicitly zip the lists:

for lpr_conv, lprm in zip(self.lpr_convs, self.lpr_modules):

3. NameError: undefined variables (n, h, w) in LPRM_efficient.forward

Near the end of forward, the following line appears:

refined_unshuffled = self.carafe_op(
    unshuffled_value,
    unshuffled_mask.softmax(dim=1).view(n, -1, h, w)
)

However, n, h, and w are never defined, producing:

NameError: name 'n' is not defined. Did you mean: 'nn'?

These should likely correspond to:

  • n = B * self.scale_sq
  • h, w = Hs, Ws

After patching these issues locally, the demo at the bottom of
SFM_fpn.py runs successfully and outputs the expected tensor shapes.


Closing Note

Thanks again for releasing this excellent work and codebase.
These small fixes should help improve ease of use for others running the demo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions