提交 44cffc55 authored 作者: Frederic's avatar Frederic

Fix doc syntax

上级 16503fe9
...@@ -1362,7 +1362,8 @@ class GpuCorr3dMM_gradWeights(BaseGpuCorr3dMM): ...@@ -1362,7 +1362,8 @@ class GpuCorr3dMM_gradWeights(BaseGpuCorr3dMM):
"""Gradient wrt. filters for `GpuCorr3dMM`. """Gradient wrt. filters for `GpuCorr3dMM`.
:note: You will not want to use this directly, but rely on Theano's :note: You will not want to use this directly, but rely on Theano's
automatic differentiation or graph optimization to use it as needed.""" automatic differentiation or graph optimization to use it as needed.
"""
def __init__(self, border_mode="valid", def __init__(self, border_mode="valid",
subsample=(1, 1, 1), subsample=(1, 1, 1),
...@@ -1417,7 +1418,8 @@ class GpuCorr3dMM_gradInputs(BaseGpuCorr3dMM): ...@@ -1417,7 +1418,8 @@ class GpuCorr3dMM_gradInputs(BaseGpuCorr3dMM):
"""Gradient wrt. inputs for `GpuCorr3dMM`. """Gradient wrt. inputs for `GpuCorr3dMM`.
:note: You will not want to use this directly, but rely on Theano's :note: You will not want to use this directly, but rely on Theano's
automatic differentiation or graph optimization to use it as needed.""" automatic differentiation or graph optimization to use it as needed.
"""
def __init__(self, border_mode="valid", def __init__(self, border_mode="valid",
subsample=(1, 1, 1), subsample=(1, 1, 1),
......
...@@ -13,6 +13,7 @@ if cuda_available: ...@@ -13,6 +13,7 @@ if cuda_available:
HostFromGpu, host_from_gpu, HostFromGpu, host_from_gpu,
GpuDimShuffle) GpuDimShuffle)
class SparseBlockGemvSS(GpuOp): class SparseBlockGemvSS(GpuOp):
""" """
This op computes the dot product of specified pieces of vectors This op computes the dot product of specified pieces of vectors
...@@ -183,7 +184,8 @@ static int SparseBlockGemv_copy(PyArrayObject *a, npy_intp *b) { ...@@ -183,7 +184,8 @@ static int SparseBlockGemv_copy(PyArrayObject *a, npy_intp *b) {
cudaMemcpyHostToDevice); cudaMemcpyHostToDevice);
Py_DECREF(aa); Py_DECREF(aa);
if (err != cudaSuccess) { if (err != cudaSuccess) {
PyErr_SetString(PyExc_RuntimeError, "Cannot copy index data to GPU"); PyErr_Format(PyExc_RuntimeError, "Cannot copy index data to GPU (%s)",
cudaGetErrorString(err));
return -1; return -1;
} }
return 0; return 0;
...@@ -241,11 +243,11 @@ Py_INCREF(%(out)s); ...@@ -241,11 +243,11 @@ Py_INCREF(%(out)s);
res = """ res = """
if (CudaNdarray_prep_output(&%(out)s, 3, CudaNdarray_HOST_DIMS(%(o)s))) if (CudaNdarray_prep_output(&%(out)s, 3, CudaNdarray_HOST_DIMS(%(o)s)))
{ {
PyErr_SetString(PyExc_RuntimeError, "Cannot allocate output"); // Error already set
%(fail)s %(fail)s
} }
if (CudaNdarray_CopyFromCudaNdarray(%(out)s, %(o)s)) { if (CudaNdarray_CopyFromCudaNdarray(%(out)s, %(o)s)) {
PyErr_SetString(PyExc_RuntimeError, "Cannot copy data to output"); // Error already set
%(fail)s %(fail)s
} }
""" % dict(out=out, o=o, fail=sub['fail']) """ % dict(out=out, o=o, fail=sub['fail'])
...@@ -313,7 +315,8 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1], ...@@ -313,7 +315,8 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1],
CudaNdarray_HOST_DIMS(%(h)s)[1] * CudaNdarray_HOST_DIMS(%(h)s)[1] *
CudaNdarray_HOST_DIMS(%(o)s)[0]); CudaNdarray_HOST_DIMS(%(o)s)[0]);
if (err != CUBLAS_STATUS_SUCCESS) { if (err != CUBLAS_STATUS_SUCCESS) {
PyErr_SetString(PyExc_RuntimeError, "SgemvBatched failed"); PyErr_Format(PyExc_RuntimeError, "SgemvBatched failed(%%s)",
cublasGetErrorString(err));
%(fail)s %(fail)s
} }
} }
...@@ -322,7 +325,7 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1], ...@@ -322,7 +325,7 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1],
W=W, fail=sub['fail'], name=nodename) W=W, fail=sub['fail'], name=nodename)
def c_code_cache_version(self): def c_code_cache_version(self):
return (10,) return (11,)
def grad(self, inputs, grads): def grad(self, inputs, grads):
o, W, h, inputIdx, outputIdx = inputs o, W, h, inputIdx, outputIdx = inputs
...@@ -482,7 +485,8 @@ static int SparseBlockOuter_copy(PyArrayObject *a, npy_intp *b) { ...@@ -482,7 +485,8 @@ static int SparseBlockOuter_copy(PyArrayObject *a, npy_intp *b) {
cudaMemcpyHostToDevice); cudaMemcpyHostToDevice);
Py_DECREF(aa); Py_DECREF(aa);
if (err != cudaSuccess) { if (err != cudaSuccess) {
PyErr_SetString(PyExc_RuntimeError, "Cannot copy index data to GPU"); PyErr_Format(PyExc_RuntimeError, "Cannot copy index data to GPU(%s)",
cudaGetErrorString(err));
return -1; return -1;
} }
return 0; return 0;
...@@ -541,11 +545,11 @@ Py_INCREF(%(out)s); ...@@ -541,11 +545,11 @@ Py_INCREF(%(out)s);
res = """ res = """
if (CudaNdarray_prep_output(&%(out)s, 4, CudaNdarray_HOST_DIMS(%(o)s))) if (CudaNdarray_prep_output(&%(out)s, 4, CudaNdarray_HOST_DIMS(%(o)s)))
{ {
PyErr_SetString(PyExc_RuntimeError, "Cannot allocate output"); // Python error already set
%(fail)s %(fail)s
} }
if (CudaNdarray_CopyFromCudaNdarray(%(out)s, %(o)s)) { if (CudaNdarray_CopyFromCudaNdarray(%(out)s, %(o)s)) {
PyErr_SetString(PyExc_RuntimeError, "Cannot copy data to output"); //Error message already set
%(fail)s %(fail)s
} }
""" % dict(out=out, o=o, fail=sub['fail']) """ % dict(out=out, o=o, fail=sub['fail'])
...@@ -612,7 +616,8 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1], ...@@ -612,7 +616,8 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1],
"block size too big. The current limit is 65535 for " "block size too big. The current limit is 65535 for "
"iSize * oSize."); "iSize * oSize.");
} else { } else {
PyErr_SetString(PyExc_RuntimeError, "SgerBatched failed"); PyErr_Format(PyExc_RuntimeError, "SgerBatched failed(%%s)",
cublasGetErrorString(err));
} }
%(fail)s %(fail)s
} }
...@@ -620,7 +625,7 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1], ...@@ -620,7 +625,7 @@ CudaNdarray_HOST_STRIDES(%(out)s)[0], CudaNdarray_HOST_STRIDES(%(out)s)[1],
alpha=alpha, fail=sub['fail']) alpha=alpha, fail=sub['fail'])
def c_code_cache_version(self): def c_code_cache_version(self):
return (9,) return (10,)
sparse_block_outer_ss = SparseBlockOuterSS(False) sparse_block_outer_ss = SparseBlockOuterSS(False)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论