Standard Function Implementations/標準的な関数実装

標準的なFunctionの実装 Chainerは、chainer.functionsパッケージによって、基本的なFunction の実装を提供しています。 多くの関数は、ユーザが使用すべきプレーンなPythonの関数によってラップされています。

Note
v1.5以降, パラメータ化された関数(parameterized functions)の概念は廃止され、対応するLinkに置き換えられました。 "parameterized functions"は、後方互換性のためにchainer.functionsの名前空間にまだ存在していますが、 chainer.linkパッケージ経由で使用することを強く推奨します。

Activation functions / 活性化関数

chainer.functions.clipped_relu

Clipped Rectifier Unit function.

Clipped ReLU関数

chainer.functions.crelu

Concatenated Rectified Linear Unit function.

CReLU関数

chainer.functions.elu

Exponential Linear Unit function.

ELU関数

chainer.functions.hard_sigmoid

Element-wise hard-sigmoid function.

要素単位でのハードシグモイド関数

chainer.functions.leaky_relu

Leaky Rectified Linear Unit function.

LReLU関数

chainer.functions.log_softmax

Channel-wise log-softmax function.

ログ(対数)+ソフトマックス関数

chainer.functions.lstm

Long Short-Term Memory units as an activation function.

活性化関数としてのLSTM(長短期記憶)

chainer.functions.maxout

Maxout activation function.

マックスアウト関数

chainer.functions.prelu

Parametric ReLU function.

PReLU関数

chainer.functions.relu

Rectified Linear Unit function.

ReLU関数

chainer.functions.selu

Scaled Exponential Linear Unit function.

SeLU関数

chainer.functions.sigmoid

Element-wise sigmoid logistic function.

要素単位でのシグモイド関数(ロジスティック関数)

chainer.functions.slstm

S-LSTM units as an activation function.

活性化関数としてのS-LSTM

chainer.functions.softmax

Softmax function.

ソフトマックス関数

chainer.functions.softplus

Element-wise softplus function.

要素単位でのソフトプラス関数

chainer.functions.tanh

Elementwise hyperbolic tangent function.

要素単位でのハイパボリックタンジェント関数

chainer.functions.tree_lstm

TreeLSTM unit as an activation function.

活性化関数としてのTreeLSTM

 

Array manipulations / 配列操作

chainer.functions.broadcast

与えられたVariablesをブロードキャストする。

chainer.functions.broadcast_to

与えられたVariablesを与えられた型にブロードキャストする

chainer.functions.cast

入力値を与えられた型にキャストする

chainer.functions.concat

与えられたVariablesを軸にそって結合する

chainer.functions.copy

与えられたVariableを指定されたデバイスにコピーする

chainer.functions.depth2space

Computes the depth2space transformation for subpixel calculations

サブピクセル計算のための変換

*論文

chainer.functions.dstack

第3軸(深さ)に添ってVariableを結合する

chainer.functions.expand_dims

コピーせず入力したVariableの次元数を拡大する

chainer.functions.flatten

与えられた配列を1次元に平坦化する

chainer.functions.flip

与えられた軸に添って入力されたVariableの順序を逆順にする

chainer.functions.fliplr

配列の左右を反転させる

chainer.functions.flipud

配列の上下を反転させる

chainer.functions.get_item

指定された型、軸、オフセットで、配列から要素を抽出する

chainer.functions.hstack

Variablesを縦方向(列方向)で結合する

chainer.functions.im2col

フィルタに基いてイメージからパッチを抽出する

chainer.functions.pad

入力したVariablesを指定された値と大きさで埋める

chainer.functions.pad_sequence

マトリックスをつくるため配列を埋める。

chainer.functions.permutate

与えられたVariableを与えられた軸で入れ替える

chainer.functions.reshape

入力値をコピーせずに再成型する

chainer.functions.resize_images

与えられた型で画像をリサイズする

chainer.functions.rollaxis

与えられたポジションから軸後方にロールする

chainer.functions.select_item

与えられたインデックス中から要素を選択する

chainer.functions.separate

与えられた軸で配列を分割する

chainer.functions.space2depth

サブピクセル計算のための space2depth 変形を演算する

chainer.functions.spatial_transformer_grid

2D Spatial Transformer grid

2次元空間変形グリッド

chainer.functions.spatial_transformer_sampler

2D Spatial Transformer sampler

2次元空間変形サンプラー

chainer.functions.split_axis

与えられたVariableを軸に添って分割する

chainer.functions.squeeze

ndarrayの次元を1次元削減する。

chainer.functions.stack

Variableを新しい軸に沿って結合する

chainer.functions.swapaxes

Variableの2つの軸を入れ替える

chainer.functions.tile

与えられた配列を並べて配列をつくる

chainer.functions.transpose

コピーせず入力値の次元を入れ替える

chainer.functions.transpose_sequence

Variableのリストを転置する

chainer.functions.vstack

Variablesを横(行)方向に結合する

chainer.functions.where

条件に合う要素を選ぶ

 

Neural network connection / ニューラルネットワーク接続

chainer.functions.bilinear

与えられた変数に双線形関数を適用する

chainer.functions.convolution_2d

2次元畳み込み関数

chainer.functions.convolution_nd

N次元畳み込み関数

chainer.functions.deconvolution_2d

2次元逆畳み込み関数

chainer.functions.deconvolution_nd

N次元逆畳み込み関数

chainer.functions.depthwise_convolution_2d

層ごとの2次元畳み込み関数

chainer.functions.dilated_convolution_2d

2次元拡張(dialate)畳み込み関数

chainer.functions.embed_id

効率的なOne-hotベクトル入力の線形関数

chainer.functions.linear

線形関数、もしくはアフィン変換

chainer.functions.n_step_bigru 積層型双方向(Bi-dimensional) GRU関数
chainer.functions.n_step_bilstm 積層型 双方向(Bi-dimensional) LSTM関数
chainer.functions.n_step_birnn シーケンス入力のための積層型双方向(Bi-dimensional)RNN関数
chainer.functions.n_step_gru 積層型一方向GRU関数
chainer.functions.n_step_lstm 積層型一方向LSTM関数
chainer.functions.n_step_rnn シーケンス入力のための積層型一方向RNN関数

 

評価関数

chainer.functions.accuracy

ミニバッチの正解率を多クラス分類する

chainer.functions.binary_accuracy ミニバッチの正解率を二項分類する
chainer.functions.classification_summary 適合率、再現率、F値、サポートを演算する
chainer.functions.r2_score R2乗(決定係数) 回帰分析のスコア演算関数

 

損失関数

chainer.functions.bernoulli_nll ベルヌーイ分布の負の対数尤度関数
chainer.functions.black_out BlackOut損失関数
chainer.functions.connectionist_temporal_classification Connectionist Temporal Classification (CTC) 損失関数 
chainer.functions.contrastive Contrastive loss演算
chainer.functions.crf1d 線形連鎖CRF(条件付き確率場)の 負の対数尤度計算
chainer.functions.argmax_crf1d

CRF(条件付き確率場)の同時確率を最大化する状態を計算する

chainer.functions.cross_covariance  y とzの二乗和相互共分散損失計算
chainer.functions.gaussian_kl_divergence ガウス分布のKLダイバージェンス
chainer.functions.gaussian_nll ガウス分布の負の対数尤度関数
chainer.functions.hinge

分類タスクの1つ、ヒンジ損失演算

chainer.functions.huber_loss

平均二乗誤差より、外れ値に敏感ではない損失関数

chainer.functions.mean_absolute_error

平均絶対誤差(MAE)関数

chainer.functions.mean_squared_error

平均二乗誤差(MSE)関数

chainer.functions.negative_sampling

負のサンプリング損失関数

chainer.functions.sigmoid_cross_entropy シグモイド活性化関数の前に行うクロスエントロピー損失計算
chainer.functions.softmax_cross_entropy ソフトマックス活性化関数の前に行うクロスエントロピー損失計算
chainer.functions.squared_error

二乗誤差関数

chainer.functions.triplet

triplet loss 演算

 

数学関数

chainer.functions.arccos 要素単位でのアークコサイン関数
chainer.functions.arcsin 要素単位でのアークサイン関数
chainer.functions.arctan 要素単位でのアークタンジェント関数
chainer.functions.arctan2 2つの変数を伴う要素単位でのアークタンジェント関数
chainer.functions.argmax

指定された軸の配列要素の最大値のインデクスを返す

chainer.functions.argmin

指定された軸の配列要素の最小値のインデクスを返す

chainer.functions.average

指定された軸の配列要素の加重平均を計算する

chainer.functions.batch_inv 正方行列のバッチの逆行列を求める
chainer.functions.batch_l2_norm_squared 正方L2 ノルム (a.k.a. ユークリッドノルム) 
chainer.functions.batch_matmul

2つの配列のバッチ行列乗算

chainer.functions.bias

ブロードキャストした要素単位での和

chainer.functions.ceil 要素単位の小数点以下切り上げ
chainer.functions.clip 要素単位の入力値の切り取り
chainer.functions.cos 要素単位のコサイン関数
chainer.functions.cosh 要素単位のハイパボリックコサイン関数
chainer.functions.exp 要素単位の指数関数
chainer.functions.fmod 要素単位のmod関数
chainer.functions.floor 要素単位の小数点以下切り捨て
chainer.functions.identity 入力値をそのまま返す
chainer.functions.inv 正方行列の逆行列を求める
chainer.functions.linear_interpolate 要素単位の線形補間
chainer.functions.log

要素単位の自然対数関数

chainer.functions.log10 要素単位の対数関数(底=10)
chainer.functions.log1p 要素単位の自然対数関数(底=e,真数=指定値+1)
chainer.functions.log2 要素単位の対数関数(底=2)
chainer.functions.logsumexp 指定された軸の配列の値の指数の和の対数を計算する
chainer.functions.matmul

2つの配列を乗算した行列を計算する

chainer.functions.max

指定された軸の配列要素の最大値

chainer.functions.maximum

入力値の要素単位での最大値

chainer.functions.mean 指定された軸の配列要素の加重平均計算
chainer.functions.min

指定された軸の配列要素の最小値

chainer.functions.minimum 入力したVariableの最小値
chainer.functions.prod 指定された軸の配列要素の積
chainer.functions.rsqrt 要素単位の平方根
chainer.functions.scale

Elementwise product with broadcasting

要素単位でブロードキャストした積

chainer.functions.sin 要素単位でのサイン関数
chainer.functions.sinh 要素単位でのハイパボリックサイン関数
chainer.functions.sqrt 要素単位での平方根計算
chainer.functions.square 要素単位での平方計算
chainer.functions.squared_difference 入力値の二乗差
chainer.functions.sum 指定された軸の配列要素の和
chainer.functions.tanh

要素単位のハイパボリックタンジェント関数

chainer.functions.tan 要素単位のタンジェント関数

 

ノイズ注入

chainer.functions.dropout 入力値の要素をランダムにドロップアウトする
chainer.functions.gaussian ガウス分布関数
chainer.functions.simplified_dropconnect ドロップコネクト(接続削減)によって正則化された線形ユニット

 

正規化関数

chainer.functions.batch_normalization バッチ正規化関数
chainer.functions.fixed_batch_normalization

Batch normalization function with fixed statistics

固定統計情報を用いるバッチ正規化関数

chainer.functions.layer_normalization

レイヤ正規化

chainer.functions.local_response_normalization

Local response normalization across neighboring channels

近傍チャネル横断LRN

chainer.functions.normalize

L2正規化(a.k.a. Euclidean norm)

(ユークリッドノルム)

 

空間プーリング

chainer.functions.average_pooling_2d 2次元空間平均プーリング関数
chainer.functions.average_pooling_nd N次元空間平均プーリング関数
chainer.functions.max_pooling_2d 二次元空間最大プーリング関数
chainer.functions.max_pooling_nd N次元空間最大プーリング関数
chainer.functions.roi_pooling_2d 空間 ROIプーリング関数
chainer.functions.spatial_pyramid_pooling_2d SPP関数(空間ピラミッドプーリング)
chainer.functions.unpooling_2d

Inverse operation of pooling for 2d array

2次元配列のためのプーリングの反転操作

chainer.functions.upsampling_2d

プーリングインデクスを用いたアップサンプリング

 

ユーティリティ関数

chainer.functions.forget

内部に持つ処理結果を伴わずに関数のみ呼び出す。