MCPcopy Create free account
hub / github.com/apache/singa / __init__

Method __init__

examples/trans/model.py:453–458  ·  view source on GitHub ↗
(self, d_model=512, n_head=8)

Source from the content-addressed store, hash-verified

451
452class ScaledDotProductAttention(layer.Layer):
453 def __init__(self, d_model=512, n_head=8):
454 super(ScaledDotProductAttention, self).__init__()
455 self.d_k = d_model // n_head
456 assert (
457 self.d_k * n_head == d_model
458 ), "embed_dim must be divisible by num_heads"
459
460 def forward(self, query, key, value, attn_mask):
461 """

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected