Skip to content

Commit

Permalink
cubic -> bilinear
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Apr 22, 2024
1 parent b37f223 commit 264313f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/custom_raster_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
"\n",
"### `resampling`\n",
"\n",
"Defaults to cubic for float Tensors and nearest for int Tensors. Can be overridden for custom resampling algorithms.\n",
"Defaults to bilinear for float Tensors and nearest for int Tensors. Can be overridden for custom resampling algorithms.\n",
"\n",
"### `separate_files`\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion tests/datasets/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_resampling_float_dtype(self, dtype: torch.dtype) -> None:
ds = CustomRasterDataset(dtype, paths)
x = ds[ds.bounds]
assert x["image"].dtype == dtype
assert ds.resampling == Resampling.cubic
assert ds.resampling == Resampling.bilinear

@pytest.mark.parametrize("dtype", [torch.long, torch.bool])
def test_resampling_int_dtype(self, dtype: torch.dtype) -> None:
Expand Down
4 changes: 2 additions & 2 deletions torchgeo/datasets/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def dtype(self) -> torch.dtype:
def resampling(self) -> Resampling:
"""Resampling algorithm used when reading input files.
Defaults to cubic for float dtypes and nearest for int dtypes.
Defaults to bilinear for float dtypes and nearest for int dtypes.
Returns:
The resampling method to use.
Expand All @@ -398,7 +398,7 @@ def resampling(self) -> Resampling:
"""
# Based on torch.is_floating_point
if self.dtype in [torch.float64, torch.float32, torch.float16, torch.bfloat16]:
return Resampling.cubic
return Resampling.bilinear
else:
return Resampling.nearest

Expand Down

0 comments on commit 264313f

Please sign in to comment.