Shared Variable interface to CUDA-allocated arrays
Return the value of this SharedVariable’s internal array.
Parameters: |
|
---|
By default get_value() copies from the GPU to a numpy.ndarray and returns that host-allocated array.
get_value(False,True) will return a GPU-allocated copy of the original GPU array.
get_value(True,True) will return the original GPU-allocated array without any copying.
Assign value to the GPU-allocated array.
Parameters: | borrow – True permits reusing value itself, False requires that this function copies value into internal storage. |
---|---|
Note : | Prior to Theano 0.3.1, set_value did not work in-place on the GPU. This meant that sometimes, GPU memory for the new value would be allocated before the old memory was released. If you’re running near the limits of GPU memory, this could cause you to run out of GPU memory. Beginning with Theano 0.3.1, set_value will work in-place on the GPU, if the following conditions are met:
It is also worth mentioning that, for efficient transfer to the GPU, Theano will make the new data c_contiguous. This can require an extra copy of the data on the host. The inplace on gpu memory work when borrow is either True or False. |