提交 e160bc39 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #4288 from nouiz/err_msg

small fix: doc, assert -> python error, printing, code clean up.
差异被折叠。
...@@ -64,7 +64,7 @@ Defining the theano function ...@@ -64,7 +64,7 @@ Defining the theano function
.. code-block:: python .. code-block:: python
f = theano.function(..., updates=updates) f = theano.function(..., updates=[(lookup_table, updates)])
Note that you can compute the gradient of the cost function w.r.t. Note that you can compute the gradient of the cost function w.r.t.
the entire lookup_table, and the gradient will have nonzero rows only the entire lookup_table, and the gradient will have nonzero rows only
......
...@@ -572,7 +572,7 @@ def use(device, ...@@ -572,7 +572,7 @@ def use(device,
if config.lib.cnmem > 1: if config.lib.cnmem > 1:
cnmem_enabled = "enabled with initial size: %d MB" % config.lib.cnmem cnmem_enabled = "enabled with initial size: %d MB" % config.lib.cnmem
else: else:
cnmem = min(config.lib.cnmem, 0.98) * 100 cnmem = min(config.lib.cnmem, 0.95) * 100
cnmem_enabled = "enabled with initial size: %.1f%% of memory" % cnmem cnmem_enabled = "enabled with initial size: %.1f%% of memory" % cnmem
else: else:
cnmem_enabled = "disabled" cnmem_enabled = "disabled"
...@@ -596,7 +596,6 @@ def use(device, ...@@ -596,7 +596,6 @@ def use(device,
cudnn_version,), cudnn_version,),
file=sys.stderr) file=sys.stderr)
if warn: if warn:
import warnings
warnings.warn(warn) warnings.warn(warn)
if device_properties(use.device_number)['regsPerBlock'] < 16384: if device_properties(use.device_number)['regsPerBlock'] < 16384:
......
...@@ -4071,7 +4071,16 @@ int CudaNdarray_CopyFromCudaNdarray(CudaNdarray * self, ...@@ -4071,7 +4071,16 @@ int CudaNdarray_CopyFromCudaNdarray(CudaNdarray * self,
}; break; }; break;
default: default:
{ {
assert (cudaSuccess == cudaGetLastError()); cudaError_t err = cudaGetLastError();
if(cudaSuccess != err){
PyErr_Format(PyExc_RuntimeError,
"Unexpected Cuda error: %s: %s\n",
"CudaNdarray_CopyFromCudaNdarray",
cudaGetErrorString(err));
Py_XDECREF(new_other);
return -1;
}
if (verbose) if (verbose)
fprintf(stderr, fprintf(stderr,
"Copying with default version unbroadcast=%d\n", "Copying with default version unbroadcast=%d\n",
...@@ -4094,7 +4103,7 @@ int CudaNdarray_CopyFromCudaNdarray(CudaNdarray * self, ...@@ -4094,7 +4103,7 @@ int CudaNdarray_CopyFromCudaNdarray(CudaNdarray * self,
CudaNdarray_DEV_DATA(self), CudaNdarray_DEV_DATA(self),
(const int *)CudaNdarray_DEV_STRIDES(self)); (const int *)CudaNdarray_DEV_STRIDES(self));
CNDA_THREAD_SYNC; CNDA_THREAD_SYNC;
cudaError_t err = cudaGetLastError(); err = cudaGetLastError();
if(verbose>1) if(verbose>1)
fprintf(stderr, fprintf(stderr,
"INFO k_elemwise_unary_rowmaj (n_blocks=%i," "INFO k_elemwise_unary_rowmaj (n_blocks=%i,"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论