assafshocher / ResizeRight

The correct way to resize images or tensors. For Numpy or Pytorch (differentiable).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numpy path broken with negative padding

harskish opened this issue · comments

The function fw_pad is supposed to perform a crop when called with negative padding values.

However, the numpy codepath raises a ValueError if np.pad() is called with negative values.
Specifically, np.pad calls _as_pairs(..., as_index=True) (link) internally which results in the error here.

I have patched the function in my fork, but I'm not sure if my fix is the most elegant.