oneAPI 1.3 暫定仕様書 Rev. 1 の解説 (22)

その他

この記事は、https://www.oneapi.io/spec/ で 2023年9月14日に公開された『oneAPI 1.3 Provisional Specification Rev. 1』 (HTMLPDF) をベースにしています。原文は2000 ページ近くあり、翻訳の時間とリソースも限られるため、全文翻訳ではなく、記事形式で区切った仕様とその解説を提供することにしました。


この回では、『oneAPI 1.3 Provisional Specification Rev. 1』の「oneDNN」の「Prelu」と「Reduction」の節を取り上げています。

PReLU

PReLU プリミティブ (トレーニング可能な alpha パラメーターを持つ Leaky ReLU) は、データテンソルに対し順方向または逆方向の計算を行います。Weights (alpha) テンソルは、ブロードキャスト・セマンティクスをサポートします。

ブロードキャスト構成は、ソースと重み (Weights) の次元から想定されます。

順方向 (前方)

PReLU 操作は次の式で定義されます。高次元と低次元のケースで一般化が容易な 2D 空間データの式のみを示します。変数名は標準の規則 (英語) に従います。

順方向トレーニングと順方向推論の違い

forward_trainingforward_inference 伝播の種類に違いはありません。

逆方向 (後方)

逆方向伝播では diff_srcdiff_weights を計算します。ブロードキャストがない場合、次の式で結果が計算されます。

実行引数

実行時に入力と出力は、次の表で示す実行引数インデックスにマップする必要があります。

操作の詳細

  1. すべての入力と出力テンソルの次元は同じである必要があります。

  2. weights テンソルの次元はブロードキャスト・セマンティクスに従う必要があります。各次元は、対応するデータの次元数に等しいか、ブロードキャストされた次元を示す 1 に等しいかのいずれかです。

post-ops と属性

PReLU プリミティブは post-ops や属性をサポートする必要がありません。

サポートされるデータタイプ

PReLU プリミティブは次のデータタイプの組み合わせをサポートします。

注: この節では、可読性のためデータタイプの名称を短縮しています。例えば、dnnl::memory::data_type::f32f32 に短縮されます。

伝播 ソース/デスティネーション
順方向/逆方向 f32s32bf16f16s8u8

データ表現

ソース、デスティネーション、およびそれらの勾配

PReLU プリミティブは任意のデータテンソルで機能します。論理的な次元については特別な意味はありません。

API

API については、こちら (英語) をご覧ください。

リダクション

リダクション・プリミティブは、指定されたアルゴリズムに従って、1 つまたは複数の任意の次元でリダクション操作を実行します。変数名は標準の規則 (英語) に従います。

ここで、reduce_opmax、minsummulmean、Lp-norm および Lp-norm-power-p であり、 はアイドル次元のインデックス、r はリダクション次元 R のインデックスです。

リダクション・アルゴリズムは次のように指定します。

平均:

|R| はリダクション次元のサイズです。

Lp-norm:

eps_opmaxsum です。

Lp-norm-power-p:

eps_opmaxsum です。

注:

  • リダクション・プリミティブでは、すべてのソースとデスティネーション・テンソルの次元は同じでなければなりません。

  • リダクションされる次元は、デスティネーション・テンソルではサイズ 1 になります。

  • リダクション・プリミティブには、順方向と逆方向の伝播の概念がありません。

実行引数

実行時に入力と出力は、次の表で示す実行引数インデックスにマップする必要があります。

操作の詳細

dst メモリー形式は、明示的に指定することも、特殊形式タグ any (推奨) を使用して指定することもできます。この場合、プリミティブはソーステンソルの形式をベースに最も適切なメモリー形式を取得できます。

サポートされるデータタイプ

リダクション・プリミティブは次のデータタイプの組み合わせをサポートします。

伝播 ソース/デスティネーション
順方向/逆方向 f32s32bf16f16s8u8

データ表現

リダクション・プリミティブは任意のデータテンソルで機能します。テンソルの次元については特別な意味はありません。

属性と post-ops

タイプ 操作 説明 制限事項
Attribute スケール 対応するテンソルにスケールを設定します。 Int8 計算のみ
Attribute ゼロポイント 対応するテンソルにゼロポイントを設定します。 Int8 計算のみ
post-op 要素ごと 結果に要素ごとの操作を適用します。
post-op バイナリー 結果にバイナリー操作を適用します。

API

API については、こちら (英語) をご覧ください。


法務上の注意書き

The content of this oneAPI Specification is licensed under the Creative Commons Attribution 4.0 International License (英語). Unless stated otherwise, the sample code examples in this document are released to you under the MIT license (英語).

This specification is a continuation of Intel’s decades-long history of working with standards groups and industry/academia initiatives such as The Khronos Group*, to create and define specifications in an open and fair process to achieve interoperability and interchangeability. oneAPI is intended to be an open specification and we encourage you to help us make it better. Your feedback is optional, but to enable Intel to incorporate any feedback you may provide to this specification, and to further upstream your feedback to other standards bodies, including The Khronos Group SYCL* specification, please submit your feedback under the terms and conditions below. Any contribution of your feedback to the oneAPI Specification does not prohibit you from also contributing your feedback directly to other standard bodies, including The Khronos Group under their respective submission policies.

By opening an issue, providing feedback, or otherwise contributing to the specification, you agree that Intel will be free to use, disclose, reproduce, modify, license, or otherwise distribute your feedback at its sole discretion without any obligations or restrictions of any kind, including without limitation, intellectual property rights or licensing obligations.

This document contains information on products, services and/or processes in development. All information provided here is subject to change without notice.

© Intel Corporation. Intel、インテル、Intel ロゴ、その他のインテルの名称やロゴは、Intel Corporation またはその子会社の商標です。

* その他の社名、製品名などは、一般に各社の表示、商標または登録商標です。

« パート 21        目次        パート 23 »
タイトルとURLをコピーしました