ぽんこつ自由研究

備忘録的な

Chainer v3.0.0リファレンスマニュアル(日本語) /Utilities

この記事については、下記サイトにまとまっています。

また、他の項目についても追記中です。

chainerfan.jimdo.com

 

勉強のために訳している記事です。翻訳や技術的な理解について、間違いを発見した場合は、コメントなどでお知らせいただければ私の理解も進み、非常にありがたいです。

 

*2017/10/09現在で、文章中にリンクがある場合、目次以外のリンク先は、全てオリジナルの英語サイトです。各オブジェクトの詳細は未着手です。

 

Chainer Reference Manual(公式ドキュメント)

http://docs.chainer.org/en/stable/reference/index.html

 

Chainer v3.0.0リファレンスマニュアル(日本語非公式)

Core Functionalities

 

Utilities

CUDA utilities

CuPyでのデバイス、コンテクスト、メモリマネージメント。

ChainerはCuPyをGPU計算のスピードを利用するために(非常に薄いラッパーとともに)使用している。 以下のモジュールとクラスは、CuPyで定義され、Chainerへは便宜上、chainer.cudaモジュールでインポートされる。(Chainerのソースコードを読む際は、下記テーブル参照)

imported name original name
chainer.cuda.cupy cupy
chainer.cuda.ndarray cupy.ndarray
chainer.cuda.cupy.cuda cupy.cuda
chainer.cuda.Device cupy.cuda.Device
chainer.cuda.Event cupy.cuda.Event
chainer.cuda.Stream cupy.cuda.Stream

ChainerはCuPyのデフォルトのアロケータをメモリ確保プールの実装によって置き換えています。 このため、forward/backward演算時の複数のデバイスメモリや、連続する要素ごとの操作のための一時的な配列、を再利用することが可能になっています。

Devices 

chainer.cuda.get_device バイスオブジェクト、数値ID、配列オブジェクトからデバイスを取得する関数
chainer.cuda.get_device_from_id 数値IDによりデバイスを取得する関数
chainer.cuda.get_device_from_array CuPy array.CuPy配列、もしくはCuPy配列のリストからデバイスを取得する関数

 

CuPy array allocation and copy

chainer.cuda.copy Copies a cupy.ndarray オブジェクトをデフォルトストリームを使用してコピーする関数
chainer.cuda.to_cpu ホストCPUへ与えられtGPU配列をコピーする関数
chainer.cuda.to_gpu 与えられたCPU配列を特定のデバイスへコピーする関数

 

Kernel definition utilities

chainer.cuda.memoize 各属性とデバイスの結果を記憶するFunctionを作成する。
chainer.cuda.clear_memo "memorize"によってデコレートされた全ての関数の"memorize"の結果をクリアする。
chainer.cuda.elementwise elementwiseのkernel functionを作成する。
chainer.cuda.reduce global reduction kernel functionを作成する。

 

CPU/GPU generic code support

chainer.cuda.get_array_module または cupyから適切なモジュールを取得する。

 

cuDNN support

chainer.cuda.set_max_workspace_size cuDNNのワークスペースサイズを設定する
chainer.cuda.get_max_workspace_size cuDNNのワークスペースサイズを取得する

 


Common algorithms

chainer.utils.WalkerAlias

chainer.utils.WalkerAlias Walker’s alias method(Walkerのエイリアス法/重み付きランダム抽出)の実装.

 


Reporter

Reporter

chainer.Reporter 収集された値を観察するためのオブジェクト
chainer.get_current_reporter カレントReporterを返す
chainer.report カレントReporerで値をreportする
chainer.report_scope カレントReporterのreportスコープを返す

Summary and DictSummary

chainer.Summary オンライン数値要約のためのオブジェクト.
chainer.DictSummary オンラインDictionary要約のためのオブジェクト

 


Experimental feature annotation

chainer.utils.experimental

cchainer.utils.experimental Experimental featureを使用する宣言