Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add torch_geometric.nn.attention to docs #10089

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions docs/source/modules/nn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,20 @@ Finally, we added full support for customization of aggregations into the :class
{{ name }}
{% endfor %}

Attention
---------

.. currentmodule:: torch_geometric.nn.attention

.. autosummary::
:nosignatures:
:toctree: ../generated
:template: autosummary/nn.rst

{% for name in torch_geometric.nn.attention.classes %}
{{ name }}
{% endfor %}

Normalization Layers
--------------------

Expand Down Expand Up @@ -226,17 +240,30 @@ KGE Models
Encodings
---------

.. automodule:: torch_geometric.nn.encoding
:members:
:undoc-members:
:exclude-members: training
.. currentmodule:: torch_geometric.nn.encoding

.. autosummary::
:nosignatures:
:toctree: ../generated
:template: autosummary/nn.rst

{% for name in torch_geometric.nn.encoding.classes %}
{{ name }}
{% endfor %}

NLP
---------

.. automodule:: torch_geometric.nn.nlp
:members:
:undoc-members:
.. currentmodule:: torch_geometric.nn.nlp

.. autosummary::
:nosignatures:
:toctree: ../generated
:template: autosummary/nn.rst

{% for name in torch_geometric.nn.nlp.classes %}
{{ name }}
{% endfor %}

Functional
----------
Expand Down
1 change: 1 addition & 0 deletions torch_geometric/nn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .models import * # noqa
from .functional import * # noqa
from .nlp import * # noqa
from .attention import * # noqa

__all__ = [
'Reshape',
Expand Down
2 changes: 1 addition & 1 deletion torch_geometric/nn/attention/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .qformer import QFormer
from .sgformer import SGFormerAttention

__all__ = [
__all__ = classes = [
'PerformerAttention',
'QFormer',
'SGFormerAttention',
Expand Down
5 changes: 5 additions & 0 deletions torch_geometric/nn/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import torch
from torch import Tensor

__all__ = classes = [
'PositionalEncoding',
'TemporalEncoding',
]


class PositionalEncoding(torch.nn.Module):
r"""The positional encoding scheme from the `"Attention Is All You Need"
Expand Down
7 changes: 7 additions & 0 deletions torch_geometric/nn/nlp/sentence_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class PoolingStrategy(Enum):


class SentenceTransformer(torch.nn.Module):
r"""A wrapper around a Sentence-Transformer from HuggingFace.

Args:
model_name (str): The HuggingFace model name, *e.g.*, :obj:`"BERT"`.
pooling_strategy (str, optional): The pooling strategy to use
for generating node embeddings. (default: :obj:`"mean"`)
"""
def __init__(
self,
model_name: str,
Expand Down
5 changes: 5 additions & 0 deletions torch_geometric/nn/nlp/vision_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@


class VisionTransformer(torch.nn.Module):
r"""A wrapper around a Vision-Transformer from HuggingFace.

Args:
model_name (str): The HuggingFace model name, *e.g.*, :obj:`"ViT"`.
"""
def __init__(
self,
model_name: str,
Expand Down
Loading