renom.cuda ¶
-
renom.cuda.
set_cuda_active
( activate=True ) ¶ -
引数にTrueが与えられた場合、cudaを有効化する.
パラメータ: activate ( bool ) -- 有効化フラグ
-
renom.cuda.
has_cuda
( ) ¶ -
cudaライブラリを使用可能か確認するための関数
戻り値: cudaライブラリが使用可能となっていればTrueを返す 戻り値の型: ( bool )
-
renom.cuda.
curand_set_seed
( seed ) ¶ -
cuRand乱数生成器に乱数シードを設定する. cudaが有効化されている状況では, cuRand乱数生成器が使用される.
パラメータ: seed ( int ) -- 乱数のシード Example
>>> import numpy as np >>> import renom as rm >>> from renom.cuda import set_cuda_active, curand_set_seed >>> set_cuda_active(True) >>> a = rm.Variable(np.arange(4).reshape(2, 2)) >>> curand_set_seed(1) >>> print(rm.dropout(a)) [[ 0. 0.] [ 4. 0.]] >>> curand_set_seed(1) >>> print(rm.dropout(a)) # Same result will be returned. [[ 0. 0.] [ 4. 0.]]
-
renom.cuda.
release_mem_pool
( ) ¶ -
確保したGPUメモリプールを開放する.
Example
>>> import numpy as np >>> import renom as rm >>> from renom.cuda import set_cuda_active, release_mem_pool >>> set_cuda_active(True) >>> a = rm.Variable(np.arange(4).reshape(2, 2)) >>> a.to_gpu() >>> a = None >>> release_mem_pool() # The data of array `a` will be released.