MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / __init__

Method __init__

openrec/modeling/decoders/parseq_decoder.py:159–162  ·  view source on GitHub ↗
(self, charset_size: int, embed_dim: int)

Source from the content-addressed store, hash-verified

157class TokenEmbedding(nn.Module):
158
159 def __init__(self, charset_size: int, embed_dim: int):
160 super().__init__()
161 self.embedding = nn.Embedding(charset_size, embed_dim)
162 self.embed_dim = embed_dim
163
164 def forward(self, tokens: torch.Tensor):
165 return math.sqrt(self.embed_dim) * self.embedding(tokens)

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected