Add more information and correct indentation of error messages in dnn_sptf

上级 5c20a163
...@@ -63,14 +63,14 @@ dnn_sptf(PyGpuArrayObject * input, ...@@ -63,14 +63,14 @@ dnn_sptf(PyGpuArrayObject * input,
break; break;
default: default:
PyErr_SetString( PyExc_TypeError, PyErr_SetString( PyExc_TypeError,
"GpuDnnTransformer: unsupported type in spatial transformer sampler" ); "GpuDnnTransformer: unsupported type for input in spatial transformer." );
return -1; return -1;
} }
if ( ! GpuArray_IS_C_CONTIGUOUS( &(input->ga) ) ) if ( ! GpuArray_IS_C_CONTIGUOUS( &(input->ga) ) )
{ {
PyErr_SetString( PyExc_MemoryError, PyErr_SetString( PyExc_MemoryError,
"GpuDnnTransformer: input data is not C-contiguous" ); "GpuDnnTransformer: input data is not C-contiguous." );
return -1; return -1;
} }
...@@ -78,7 +78,8 @@ dnn_sptf(PyGpuArrayObject * input, ...@@ -78,7 +78,8 @@ dnn_sptf(PyGpuArrayObject * input,
theta->ga.typecode != GA_DOUBLE && theta->ga.typecode != GA_DOUBLE &&
theta->ga.typecode != GA_HALF ) theta->ga.typecode != GA_HALF )
{ {
PyErr_SetString( PyExc_TypeError, "GpuDnnTransformer: unsupported data type for theta" ); PyErr_SetString( PyExc_TypeError,
"GpuDnnTransformer: unsupported data type for theta in spatial transformer." );
return -1; return -1;
} }
else if ( PyGpuArray_NDIM( theta ) != 3 ) else if ( PyGpuArray_NDIM( theta ) != 3 )
...@@ -245,8 +246,9 @@ dnn_sptf(PyGpuArrayObject * input, ...@@ -245,8 +246,9 @@ dnn_sptf(PyGpuArrayObject * input,
if ( CUDNN_STATUS_SUCCESS != err ) if ( CUDNN_STATUS_SUCCESS != err )
{ {
PyErr_SetString( PyExc_RuntimeError, PyErr_Format( PyExc_RuntimeError,
"GpuDnnTransformer: failed to create grid sampler" ); "GpuDnnTransformer: failed to create grid sampler: %s",
cudnnGetErrorString( err ) );
spatialtf_context_destroy( &spatialtf_ctx ); spatialtf_context_destroy( &spatialtf_ctx );
cuda_exit( gpu_ctx->ctx ); cuda_exit( gpu_ctx->ctx );
return -1; return -1;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论