Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stanfordnlp/stanza.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Bauer <horatio@gmail.com>2022-11-11 11:41:02 +0300
committerJohn Bauer <horatio@gmail.com>2022-11-11 11:41:02 +0300
commitff0cb0f6a4a2ac9ed4e0768fd0655d35c7626898 (patch)
treed8a6f404318db654474d1b31bb2fee9ab2ffee3b
parent8b57984815c9a80101d22f8d5c8aaf4377799f51 (diff)
Add a tiny bit of doc to the positional encoding
-rw-r--r--stanza/models/constituency/positional_encoding.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/stanza/models/constituency/positional_encoding.py b/stanza/models/constituency/positional_encoding.py
index cce1c5b3..8a9f5235 100644
--- a/stanza/models/constituency/positional_encoding.py
+++ b/stanza/models/constituency/positional_encoding.py
@@ -45,7 +45,9 @@ class SinusoidalEncoding(nn.Module):
class AddSinusoidalEncoding(nn.Module):
"""
- Uses sine & cosine to represent position
+ Uses sine & cosine to represent position. Adds the position to the given matrix
+
+ Default behavior is batch_first
"""
def __init__(self, d_model=256, max_len=512):
super().__init__()
@@ -69,7 +71,9 @@ class AddSinusoidalEncoding(nn.Module):
class ConcatSinusoidalEncoding(nn.Module):
"""
- Uses sine & cosine to represent position
+ Uses sine & cosine to represent position. Concats the position and returns a larger object
+
+ Default behavior is batch_first
"""
def __init__(self, d_model=256, max_len=512):
super().__init__()