Skip to content

Commit

Permalink
Guide about Embedding2d (#80)
Browse files Browse the repository at this point in the history
This patch adds guide about the spatial embedding module.
  • Loading branch information
ybubnov authored Aug 23, 2024
1 parent 5640459 commit 0096c67
Show file tree
Hide file tree
Showing 5 changed files with 440 additions and 8 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ input = torch.DoubleTensor(200, 2).uniform_(0.0, 10.0)
output = pool(input)
```

Using 2-dimensional embedding module for learning data on sphere:
```py
import torch
from torch_geopooling.nn import Embedding2d

embedding = Embedding2d((16, 16, 2), padding=(3, 3), exterior=(-100, 100, 200.0, 200.0))
input = torch.DoubleTensor(1024, 2).normal_(5.0, 1.0)
output = embedding(input)
```

## License

The Torch Geopooling is distributed under GPLv3 license. See the [LICENSE](LICENSE) file for full
Expand Down
61 changes: 53 additions & 8 deletions docs/guide/getting_started.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ assumed that a reader knows fundamentals of the `PyTorch`_ library.
getting_started.ipynb
house_prices.ipynb
pooling_polygons.ipynb
spatial_embedding.ipynb


.. _PyTorch: https://pytorch.org/tutorials/beginner/basics/intro.html
375 changes: 375 additions & 0 deletions docs/guide/spatial_embedding.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions torch_geopooling/nn/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(
padding: Tuple[int, int] = (0, 0),
) -> None:
super().__init__()
self.manifold = manifold
self.exterior = cast(ExteriorTuple, tuple(map(float, exterior)))
self.padding = padding

Expand Down

0 comments on commit 0096c67

Please sign in to comment.