question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feat] kornia.Resize has a bad default for align_corners

See original GitHub issue

🐛 Bug

kornia.Resize has a bad default for align_corners if interpolation=="nearest" or interpolation=="area".

To Reproduce

import torch
import kornia

transform = kornia.Resize(32, interpolation="nearest")

input = torch.rand(1, 3, 16, 16)
transform(input)
ValueError: align_corners option can only be set with the interpolating modes: linear | bilinear | bicubic | trilinear

Expected behavior

This should work out of the box. You need to explicitly set align_corners=None to get this working. This is neither documented nor even accepted by the type annotations.

Environment

kornia==0.4.1

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
adamjstewartcommented, Nov 27, 2022

This appears to be fixed in the latest release. The following has no errors:

transform = kornia.geometry.transform.Resize(32, interpolation="nearest")

although the original error can be reproduced with:

transform = kornia.geometry.transform.Resize(32, interpolation="nearest", align_corners=True)
1reaction
pmeiercommented, Dec 1, 2020

Sorry for the delay. I can give it a shot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

kornia.geometry.transform - Read the Docs
align_corners ( bool , optional) – interpolation flag. Default: True ... kornia.geometry.transform.scale(tensor, scale_factor, center=None, mode='bilinear', ...
Read more >
Open Source Differentiable Computer Vision Library for PyTorch
At a granular level, Kornia is a library that consists of the ... The param align_corners has been set by default to None...
Read more >
Open Source Differentiable Computer Vision ... - PythonRepo
kornia/kornia/, Kornia is a differentiable computer vision library ... The param align_corners has been set by default to None that maps to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found