selfAttentionLayer
説明
自己注意層は、入力のシングルヘッドまたはマルチヘッドの自己注意を計算します。
この層は以下を行います。
入力からクエリ、キー、および値を計算する
クエリ、キー、および値を使用して、ヘッド全体でスケールされたドット積アテンションを計算する
ヘッドからの結果をマージする
マージされた結果に対して線形変換を実行する
作成
構文
説明
は、自己注意層を作成し、layer
= selfAttentionLayer(numHeads,numKeyChannels)NumHeads
プロパティおよび NumKeyChannels
プロパティを設定します。
は、オプションの layer
= selfAttentionLayer(numHeads,numKeyChannels,Name=Value
)NumValueChannels
、OutputSize
、HasPaddingMaskInput
、AttentionMask
、DropoutProbability
、HasScoresOutput
、パラメーターと初期化、学習率および正則化、および Name
のプロパティを設定します。
プロパティ
例
アルゴリズム
参照
[1] Vaswani, Ashish, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. "Attention is all you need." In Advances in Neural Information Processing Systems, Vol. 30. Curran Associates, Inc., 2017. https://papers.nips.cc/paper/7181-attention-is-all-you-need.
[2] Glorot, Xavier, and Yoshua Bengio. "Understanding the Difficulty of Training Deep Feedforward Neural Networks." In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, 249–356. Sardinia, Italy: AISTATS, 2010. https://proceedings.mlr.press/v9/glorot10a/glorot10a.pdf
[3] He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. "Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification." In 2015 IEEE International Conference on Computer Vision (ICCV), 1026–34. Santiago, Chile: IEEE, 2015. https://doi.org/10.1109/ICCV.2015.123
拡張機能
バージョン履歴
R2023a で導入