Shortcuts

ScaledDotProductAttention

class mmocr.models.common.ScaledDotProductAttention(temperature, attn_dropout=0.1)[源代码]

Scaled Dot-Product Attention Module. This code is adopted from https://github.com/jadore801120/attention-is-all-you-need-pytorch.

参数
  • temperature (float) – The scale factor for softmax input.

  • attn_dropout (float) – Dropout layer on attn_output_weights.

forward(q, k, v, mask=None)[源代码]

Defines the computation performed at every call.

Should be overridden by all subclasses.

注解

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Read the Docs v: dev-1.x
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.