torch-geopooling 1.1.1__cp311-cp311-macosx_11_0_arm64.whl → 1.1.3__cp311-cp311-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of torch-geopooling might be problematic. Click here for more details.

Binary file
@@ -1,3 +1,3 @@
1
1
  from typing import Final
2
2
 
3
- __version__: Final[str] = "1.1.1"
3
+ __version__: Final[str] = "1.1.3"
@@ -32,22 +32,26 @@ class Function(autograd.Function):
32
32
  weight: Tensor,
33
33
  padding: Tuple[int, int],
34
34
  exterior: ExteriorTuple,
35
+ reflection: bool,
35
36
  ) -> Tensor:
36
- return _C.embedding2d(input, weight, padding, exterior)
37
+ return _C.embedding2d(input, weight, padding, exterior, reflection)
37
38
 
38
39
  @staticmethod
39
40
  def setup_context(ctx: FunctionCtx, inputs: Tuple, outputs: Tuple) -> None:
40
- input, weight, padding, exterior = inputs
41
+ input, weight, padding, exterior, reflection = inputs
41
42
 
42
43
  ctx.save_for_backward(input, weight)
43
44
  ctx.padding = padding
44
45
  ctx.exterior = exterior
46
+ ctx.reflection = reflection
45
47
 
46
48
  @staticmethod
47
49
  def backward(ctx: FunctionCtx, grad: Tensor) -> Tuple[Optional[Tensor], ...]:
48
50
  input, weight = ctx.saved_tensors
49
- grad_weight = _C.embedding2d_backward(grad, input, weight, ctx.padding, ctx.exterior)
50
- return None, grad_weight, None, None
51
+ grad_weight = _C.embedding2d_backward(
52
+ grad, input, weight, ctx.padding, ctx.exterior, ctx.reflection
53
+ )
54
+ return None, grad_weight, None, None, None
51
55
 
52
56
 
53
57
  def embedding2d(
@@ -56,6 +60,7 @@ def embedding2d(
56
60
  *,
57
61
  padding: Tuple[int, int] = (0, 0),
58
62
  exterior: ExteriorTuple,
63
+ reflection: bool = True,
59
64
  ) -> Tensor:
60
65
  """
61
66
  Retrieves spatial embeddings from a fixed-size lookup table based on 2D coordinates.
@@ -77,9 +82,11 @@ def embedding2d(
77
82
  exterior: The geometric boundary of the learning space, specified as a tuple (X, Y, W, H),
78
83
  where X and Y represent the origin, and W and H represent the width and height of the
79
84
  space, respectively.
85
+ reflection: When true, kernel is wrapped around the exterior space, otherwise kernel is
86
+ squeezed into borders.
80
87
 
81
88
  Returns:
82
89
  Tensor: The retrieved spatial embeddings corresponding to the input coordinates.
83
90
  """
84
91
 
85
- return Function.apply(input, weight, padding, exterior)
92
+ return Function.apply(input, weight, padding, exterior, reflection)
@@ -26,6 +26,7 @@ def test_embedding2d() -> None:
26
26
  weight,
27
27
  padding=(3, 2),
28
28
  exterior=(-10.0, -10.0, 20.0, 20.0),
29
+ reflection=True,
29
30
  )
30
31
 
31
32
  assert result.size() == torch.Size([100, 7, 5, 3])
@@ -46,6 +46,8 @@ class Embedding2d(nn.Module):
46
46
  exterior: The geometric boundary of the learning space, specified as a tuple (X, Y, W, H),
47
47
  where X and Y represent the origin, and W and H represent the width and height of the
48
48
  space, respectively.
49
+ reflection: When true, kernel is wrapped around the exterior space, otherwise kernel is
50
+ squeezed into borders.
49
51
 
50
52
  Shape:
51
53
  - Input: :math:`(*, 2)`, where 2 comprises x and y coordinates.
@@ -74,17 +76,27 @@ class Embedding2d(nn.Module):
74
76
  manifold: Tuple[int, int, int],
75
77
  exterior: _Exterior,
76
78
  padding: Tuple[int, int] = (0, 0),
79
+ reflection: bool = True,
77
80
  ) -> None:
78
81
  super().__init__()
79
82
  self.manifold = manifold
80
83
  self.exterior = cast(ExteriorTuple, tuple(map(float, exterior)))
81
84
  self.padding = padding
85
+ self.reflection = reflection
82
86
 
83
87
  self.weight = nn.Parameter(torch.empty(manifold, dtype=torch.float64))
84
88
  nn.init.zeros_(self.weight)
85
89
 
86
90
  def extra_repr(self) -> str:
87
- return "{manifold}, exterior={exterior}, padding={padding}".format(**self.__dict__)
91
+ return "{manifold}, exterior={exterior}, padding={padding}, reflection={reflection}".format(
92
+ **self.__dict__
93
+ )
88
94
 
89
95
  def forward(self, input: Tensor) -> Tensor:
90
- return F.embedding2d(input, self.weight, exterior=self.exterior, padding=self.padding)
96
+ return F.embedding2d(
97
+ input,
98
+ self.weight,
99
+ exterior=self.exterior,
100
+ padding=self.padding,
101
+ reflection=self.reflection,
102
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: torch-geopooling
3
- Version: 1.1.1
3
+ Version: 1.1.3
4
4
  Summary: The geospatial pooling modules for neural networks in PyTorch
5
5
  Author-email: Yakau Bubnou <girokompass@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -678,8 +678,9 @@ License: GNU GENERAL PUBLIC LICENSE
678
678
  Public License instead of this License. But first, please read
679
679
  <https://www.gnu.org/licenses/why-not-lgpl.html>.
680
680
 
681
- Project-URL: homepage, https://github.com/ybubnov/torch_geopooling
682
- Project-URL: source, https://github.com/ybubnov/torch_geopooling
681
+ Project-URL: Funding, https://github.com/sponsors/ybubnov
682
+ Project-URL: Homepage, https://github.com/ybubnov/torch_geopooling
683
+ Project-URL: Source, https://github.com/ybubnov/torch_geopooling
683
684
  Classifier: Development Status :: 5 - Production/Stable
684
685
  Classifier: Intended Audience :: Developers
685
686
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -1,5 +1,5 @@
1
- torch_geopooling/_C.cpython-311-darwin.so,sha256=dpo_iE-MBHZaOAoS0DgT1Ill2AEzjJdoJcrbN8jHO60,562392
2
- torch_geopooling/__init__.py,sha256=gocbEzjrMP-BkhotjSAi8QMuhKTEaRaMwBD6JC2R9is,60
1
+ torch_geopooling/_C.cpython-311-darwin.so,sha256=u8BwD81ZbDW67kXdcw1vIpXIjmdjcnAq7pxUHXXoBg0,562456
2
+ torch_geopooling/__init__.py,sha256=CROWMdWTzTHqjegRUeZDiBVdHGMpLVPdiLbslUu24hE,60
3
3
  torch_geopooling/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  torch_geopooling/return_types.py,sha256=QhIKf_qxpppzuZzUrT-VacfbvZ6zKmSRu-WZOqL8wuE,898
5
5
  torch_geopooling/tiling.py,sha256=f1g0Gf__5zIOafZzDkwO62t9OqMDMBEYVtM2HXB5X0Y,2553
@@ -7,18 +7,18 @@ torch_geopooling/transforms.py,sha256=NHPBgx1L4-1745xNO_PvLuvbMH6DWi2rs1ViuRyBQA
7
7
  torch_geopooling/transforms_test.py,sha256=Cqp4VVObBVrc8HQ7uxkpe1EsQ5NxXrCI77BiUqngLXw,1196
8
8
  torch_geopooling/__bind__/python_module.cc,sha256=LLI363riung_4LI5ugN7Pm93iuoHDRF7n4Y4RlkzLYk,675
9
9
  torch_geopooling/functional/__init__.py,sha256=BCcS22yPWITm37M-EPD-PK6WrS7grikDR8uZdoO8sZ4,118
10
- torch_geopooling/functional/embedding.py,sha256=ER0KB-G7SoCsWJuNEqXRC_XcLdhqaCpn5OJPpUF9pLc,3337
11
- torch_geopooling/functional/embedding_test.py,sha256=B5a1MP0rynX01a1RmmTJHZxMi4Y68cQoblw-kQawHJM,1094
10
+ torch_geopooling/functional/embedding.py,sha256=Pd01LuVhrDVRb35_7YaJwmdPeCYSZ1fzvvV7NZ03BR8,3639
11
+ torch_geopooling/functional/embedding_test.py,sha256=n844pekbw01I1WtAMsRfvlw4nFSBTrPNjMtRrUPd1ZY,1119
12
12
  torch_geopooling/functional/pooling.py,sha256=MuJfPW_RC4slgzWBO2ngQIBTzlZXeW7DBqV3ooIOSw4,12060
13
13
  torch_geopooling/functional/pooling_test.py,sha256=qBT_WVbwyANolwg7-rE7KimF-bAEDB44guBl4OQuQhE,3005
14
14
  torch_geopooling/nn/__init__.py,sha256=fWrhfQu0_KzW7VUesk31Sy3n3Om2c5g5dGA3vrLcCg4,102
15
- torch_geopooling/nn/embedding.py,sha256=3uF0zbtql90FUpRNKJK_oUcdL8_J6mrOpPm-zTJWlX4,3350
15
+ torch_geopooling/nn/embedding.py,sha256=MD8oTH2IP2g368NVZJoxcXqND-pQ1gXDMvt9F31rMbk,3697
16
16
  torch_geopooling/nn/embedding_test.py,sha256=msUeidL9Xkf3AKCPGQH9SJAhfkS7dyqYRzsH88Pt1uY,1505
17
17
  torch_geopooling/nn/pooling.py,sha256=_NnGB45dWTZy4MQokFfmJL3as-EPVU3liwOuAmWbv1Y,14219
18
18
  torch_geopooling/nn/pooling_test.py,sha256=AqnkpaQ6LcQxh5bWkuDuBAJ2XiBc-C2zVuUp5hynzBM,4794
19
- torch_geopooling-1.1.1.dist-info/LICENSE,sha256=jLc4eyvG8hqxH4AdKAjK2DwXoP68qjHiGfq8eP5ubBI,35069
20
- torch_geopooling-1.1.1.dist-info/METADATA,sha256=20wqd_pqv0QO2bIkgG078qmqt3DXXy2Uxk1xrKIKpp8,44675
21
- torch_geopooling-1.1.1.dist-info/WHEEL,sha256=LFVzND6nAdWMS-norKkn42oL86bk-j1PiLvh1xzptX0,110
22
- torch_geopooling-1.1.1.dist-info/dependency_links.txt,sha256=JqLDcYHtEaQB51V72n3gAJvRd36bpoPk9qgTbot-Lx4,37
23
- torch_geopooling-1.1.1.dist-info/top_level.txt,sha256=3geTL2nsLvybdtr1psWIE6h63B1LuyIIyWWv0rDafTk,17
24
- torch_geopooling-1.1.1.dist-info/RECORD,,
19
+ torch_geopooling-1.1.3.dist-info/LICENSE,sha256=jLc4eyvG8hqxH4AdKAjK2DwXoP68qjHiGfq8eP5ubBI,35069
20
+ torch_geopooling-1.1.3.dist-info/METADATA,sha256=Hx1VAuGyOub05B8punE5-REXkFCIzLCABzrsRMX3uS4,44733
21
+ torch_geopooling-1.1.3.dist-info/WHEEL,sha256=LFVzND6nAdWMS-norKkn42oL86bk-j1PiLvh1xzptX0,110
22
+ torch_geopooling-1.1.3.dist-info/dependency_links.txt,sha256=JqLDcYHtEaQB51V72n3gAJvRd36bpoPk9qgTbot-Lx4,37
23
+ torch_geopooling-1.1.3.dist-info/top_level.txt,sha256=3geTL2nsLvybdtr1psWIE6h63B1LuyIIyWWv0rDafTk,17
24
+ torch_geopooling-1.1.3.dist-info/RECORD,,