Rockchip · AI & Linux Hub

AI 推論

RKNN2 V2.5.0 · RV1103B/RV1106B:活動、正規化および延長

RKNN2 V2.5.0 · RV1103B/RV1106B:Activations、正規化および延長 ·V2.5.0の源からの完全なオペレータ変数そして制約。

このRKNN2 V2.5.0プラットフォームリファレンスは、ArmSoM開発者がモデルを選択および適応するのに役立ちます。 すべてのArmSoMボードでのサポートを確立しません。ボードSOC、実際のツールキット2、ランタイム、NPUドライバ、BSPバージョンを確認します。 ソースは、ユニバーサルLinuxカーネルバージョンを指すものではありません。 ArmSoM ハードウェア検証は行いません。

出典:中国と英語のRKNN2サポートオペレータとコントレイント参照V2.5.0、374および384ページそれぞれ。 中国語は中国語版に続いています。英語、ロシア語、ドイツ語は英語版に従います。 プラットフォームの制約は分離されず、 英語PDF自体には中国語I/O図と出力テーブルが含まれており、その実証は編集可能なローカライズされたテーブルで保持されます。 ConvTranpose や元の LSTM/GRU などのソースのスペルが保存されます。これらの式は SDK 実装に修正されません。

出典ページ:CN 343–352;EN 353–362。

RockchipRKNN2

オペレータ参照シリーズ

RKNN2 V2.5.0・RK3566/RK3568:基本と進化

RKNN2 V2.5.0・RK3566/RK3568:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RK3566/RK3568:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RK3566/RK3568:活性化、正規化、拡張機能

RKNN2 V2.5.0・RK3588:基本と進化

RKNN2 V2.5.0・RK3588:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RK3588:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RK3588:アクティベーション、正規化、拡張機能

RKNN2 V2.5.0・RK3562:基本と進化

RKNN2 V2.5.0・RK3562:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RK3562:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RK3562:アクティベーション、正規化、拡張機能

RKNN2 V2.5.0・RV1103/RV1106:基本と進化

RKNN2 V2.5.0・RV1103/RV1106:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RV1103/RV1106:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RV1103/RV1106:活性化、正規化、拡張機能

RKNN2 V2.5.0・RK3576/RV1126B:基本と進化

RKNN2 V2.5.0・RK3576/RV1126B:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RK3576/RV1126B:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RK3576/RV1126B:活性化、正規化、拡張機能

RKNN2 V2.5.0・RK2118:基本と進化

RKNN2 V2.5.0・RK2118:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RK2118:形状、スライシング、トランスポーズ

RKNN2 V2.5.0・RK2118:アクティベーション、正規化、拡張機能

RKNN2 V2.5.0・RV1103B/RV1106B:基本と進化

RKNN2 V2.5.0・RV1103B/RV1106B:再発ネットワーク、算術およびプール

RKNN2 V2.5.0・RV1103B/RV1106B:形状、スライシング、トランスポーズ

RKNN2 V2.5.0 · RV1103B/RV1106B:活動、正規化および延長

RKNN2 V2.5.0・CPU オペレータサポートと制約

RKNN2 V2.5.0・GPU オペレータサポートと制約

RKNN2 V2.5.0・モデルI/O、アライメント、コンボリューション制限

シグモイド

入力テンソルを与えられた、関数 y=1/(1+exp(-x) は出力テンソルを生成するために入力テンソルに要素単位で加えられます

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

出力

  • 出力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)

タン

指定した入力テンソル要素のハイパーボリックな形を計算します。

導入事例

  • X:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

出力

  • Y:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

データ型制約

  • T1:int8(センサー)

ソフトプラス

Softplus 関数要素を y=ln(exp(x)+1) に指定します。

導入事例

  • X:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

出力

  • Y:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

データ型制約

  • T1:int8(センサー)

硬いシグミノイド

入力テンソルを与えられた、関数 y=max(0,min(1,alpha*x+beta)) は、出力テンソルを生成するために入力テンソルに要素単位で適用されます。

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

出力

  • 出力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)

硬いスウェーデン

HardSwish 関数要素を賢く、y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid(x), alpha=1/6, beta=0.5

導入事例

  • X:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

出力

  • Y:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

データ型制約

  • T1:int8(センサー)

ソリューション

入力テンソルを、x<0、f(x)=xのx>=0のための機能f(x)=alpha*(exp(x)-1.)は出力テンソルを作り出すために入力テンソルに要素単位で加えられます、 alpha=1

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

出力

  • 出力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)

exSwish

ジグモイドリニアユニット関数要素を同様に適用します。 Swish 関数は SiLU 関数、y=x*sigmoid(x) とも呼ばれます

導入事例

  • X:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

出力

  • Y:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

データ型制約

  • T1:int8(センサー)

exMish

入力テンソル、関数のimh(x)=xtanh(softplus(x))=xtanh(ln(1+e^{x}))を、出力テンソルを生成するために入力テンソルに要素単位で加えられます

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

出力

  • 出力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)

exGelu

入力テンソルを与えられたy=x*Φ(x)は出力テンソルを生成するために要素単位で加えられます。 Φ(x) が tanh に設定されるとき: y=0.5*x*(1+Tanh(sqrt(2/π)*(x+0.044715*x^3)))))。

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

出力

  • 出力:T1
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)

どこまでも

マスク_tensor の x_tensor や y_tensor の値を取得します。 マスク_tensor のポジションが真の場合、対応する位置の x_tensor の値が取られます。そうしないと、y_tensor の値が取り込まれます。

導入事例

  • マスク_tensor:T1
    • shape:[batch,channel,height,width]
    • Broadcasting support
      • Supports broadcasting along arbitrary dimensions
    • Broadcasting constraints
      • Broadcasting constraints are the same as the Expand operator
  • x_tensor:*T2 の
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer
    • Broadcasting support
      • Supports broadcasting along arbitrary dimensions
    • Broadcasting constraints
      • Broadcasting constraints are the same as the Expand operator
  • y_tensor:T1 の
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer
    • Broadcasting support
      • Supports broadcasting along arbitrary dimensions
    • Broadcasting constraints
      • Broadcasting constraints are the same as the Expand operator

出力

  • 出力:T2
    • shape:[batch,channel,height,width]
    • Quantization support
      • per-layer

データ型制約

  • T1:bool (センサー)
  • T2:int8(センサー)

exGlu

出力された線形単位機能、入力行列の先頭半分であり、bは2番目の半分のGLU(a,b)=aσ(b)です

導入事例

  • 入力:T1
    • shape:[batch,channel,height,width]
    • Quantization support:per-layer

出力

  • 出力:T1
    • shape:[batch,channel/2,height,width]
    • Quantization support:per-layer

データ型制約

  • T1:int8(センサー)

属性

  • axis: int (デフォルト値 = 1)
    • The dimension to split the input
    • Constraint: only 1 is supported

exMatMul

マトリックスの乗算操作

Y = A·B + C    if c_type = "add"
Y = A·B * C    if c_type = "mul"

導入事例

  • A:T1
    • shape:[b,k,1,n]
      • k ∈(0,8192]
    • Quantization support
      • per-layer
  • B:T1
    • shape:[b,k,1,m]
    • Quantization support
      • per-layer
  • C (任意):T1、T2
    • shape:[b,n,1,m]
    • Quantization support
      • per-layer
    • Broadcasting support
      • Supports broadcasting along arbitrary dimensions
      • Broadcasting constraints are the same as the Expand operator

出力

  • Y:T1
    • shape:[b,n,1,m]
    • Quantization support
      • per-layer

データ型制約

  • T1:int8(センサー)
  • T2:フロート(センサー)

属性

  • c_type: 文字列 (デフォルト “add”)
    • add and mul are optional, indicating whether C is added or multiplied

exWindow

exWindowは、swin_transformerのwindow_partitionとwindow_reverse操作から始まります。 オリジナルの紙では、入力機能は複数の非重複ウィンドウに分割され、各サイズのウィンドウ_size×window_size。 入出力機能と出力機能は、高さと幅のどちらの方向でも4次元形状で分割する必要があります。 pytorch の実装は以下のとおりです。

def window_partition(x, window_size):
    """
    Args:
        x: (B, C, H, W)
        window_size (int): window size
    Returns:
        windows: (B, C, num_windows * num_windows, window_size * window_size)
    """
    B, C, H, W = x.shape
    x = x.view(B, C, H // window_size, window_size, W // window_size, window_size)
    windows = x.permute(0, 1, 2, 4, 3, 5).contiguous().view(B, C, -1, window_size * window_size)
    return windows

def window_reverse(windows, window_size, H, W):
    """
    Args:
        windows: (B, C, num_windows * num_windows, window_size * window_size)
        window_size (int): Window size
        H (int): Height of image
        W (int): Width of image
    Returns:
        x: (B, C, H, W)
    """
    B, C, _, _ = windows.shape
    x = windows.view(B, C, H // window_size, W // window_size, window_size, window_size)
    x = x.permute(0, 1, 2, 4, 3, 5).contiguous().view(B, C, H, W)
    return x

導入事例

  • X:T1
    • shape:[batch,channel,height,width]

出力

  • Y:T1
    • shape:[batch,channel,height,width]

データ型制約

  • T1:int8(センサー)

属性

  • モード:string
    • Supported modes: partition, reverse, partition_num_first
      • partition: implemented with reference to window_partition;
      • reverse: implemented with reference to window_reverse;
      • partition_num_first: the difference from partition is that the H,W of partition_num_first are divided according to num_windows, while the H,W of partition are divided according to window_sizes.
  • window_sizes:listofints の一覧
    • A 2-dimensional vector, the window size. Defines the height and width of each window. Attention computation and feature extraction within the window are based on this size.
  • num_windows:listofints(リストフォート)
    • A 2-dimensional vector, the number of windows. Defines how many windows the height and width of the input feature are divided into.

その他のサポート

  • マルチコア:未対応
  • 3566/3568 OP仕様紹介
  • 3588 OP仕様紹介
  • 3562 OP仕様紹介
  • 1103/1106 OP仕様紹介
  • 3576/RV1126B OPの指定の導入
  • 2118 OP仕様紹介
  • 1103B/1106B OP仕様紹介

このトピックを詳しく見る → · 学習ガイド →