提交 c107d35d authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Rename out to dx for clarity.

上级 e237869c
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
cudnnTensorDescriptor_t APPLY_SPECIFIC(dy); cudnnTensorDescriptor_t APPLY_SPECIFIC(dy);
cudnnTensorDescriptor_t APPLY_SPECIFIC(sm); cudnnTensorDescriptor_t APPLY_SPECIFIC(sm);
cudnnTensorDescriptor_t APPLY_SPECIFIC(out); cudnnTensorDescriptor_t APPLY_SPECIFIC(dx);
#section init_code_struct #section init_code_struct
APPLY_SPECIFIC(dy) = NULL; APPLY_SPECIFIC(dy) = NULL;
APPLY_SPECIFIC(sm) = NULL; APPLY_SPECIFIC(sm) = NULL;
APPLY_SPECIFIC(out) = NULL; APPLY_SPECIFIC(dx) = NULL;
{ {
cudnnStatus_t err; cudnnStatus_t err;
...@@ -24,7 +24,7 @@ APPLY_SPECIFIC(out) = NULL; ...@@ -24,7 +24,7 @@ APPLY_SPECIFIC(out) = NULL;
cudnnGetErrorString(err)); cudnnGetErrorString(err));
FAIL; FAIL;
} }
err = cudnnCreateTensorDescriptor(&APPLY_SPECIFIC(out)); err = cudnnCreateTensorDescriptor(&APPLY_SPECIFIC(dx));
if (err != CUDNN_STATUS_SUCCESS) { if (err != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_MemoryError, "could not allocate tensor descriptor: %s", PyErr_Format(PyExc_MemoryError, "could not allocate tensor descriptor: %s",
cudnnGetErrorString(err)); cudnnGetErrorString(err));
...@@ -38,14 +38,14 @@ if (APPLY_SPECIFIC(dy) != NULL) ...@@ -38,14 +38,14 @@ if (APPLY_SPECIFIC(dy) != NULL)
cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(dy)); cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(dy));
if (APPLY_SPECIFIC(sm) != NULL) if (APPLY_SPECIFIC(sm) != NULL)
cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(sm)); cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(sm));
if (APPLY_SPECIFIC(out) != NULL) if (APPLY_SPECIFIC(dx) != NULL)
cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(out)); cudnnDestroyTensorDescriptor(APPLY_SPECIFIC(dx));
#section support_code_struct #section support_code_struct
int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy, int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy,
PyGpuArrayObject *sm, PyGpuArrayObject *sm,
PyGpuArrayObject **out) { PyGpuArrayObject **dx) {
cudnnStatus_t err; cudnnStatus_t err;
PyGpuContextObject *c = pygpu_default_context(); PyGpuContextObject *c = pygpu_default_context();
...@@ -54,12 +54,12 @@ int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy, ...@@ -54,12 +54,12 @@ int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy,
if (c_set_tensorNd(sm, APPLY_SPECIFIC(sm)) != 0) if (c_set_tensorNd(sm, APPLY_SPECIFIC(sm)) != 0)
return 1; return 1;
if (theano_prep_output(out, PyGpuArray_NDIM(dy), if (theano_prep_output(dx, PyGpuArray_NDIM(dy),
PyGpuArray_DIMS(dy), dy->ga.typecode, PyGpuArray_DIMS(dy), dy->ga.typecode,
GA_C_ORDER, c) != 0) GA_C_ORDER, c) != 0)
return 1; return 1;
if (c_set_tensorNd(*out, APPLY_SPECIFIC(out)) != 0) if (c_set_tensorNd(*dx, APPLY_SPECIFIC(dx)) != 0)
return 1; return 1;
{ {
...@@ -95,8 +95,8 @@ int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy, ...@@ -95,8 +95,8 @@ int APPLY_SPECIFIC(softmax_grad)(PyGpuArrayObject *dy,
APPLY_SPECIFIC(dy), APPLY_SPECIFIC(dy),
PyGpuArray_DEV_DATA(dy), PyGpuArray_DEV_DATA(dy),
beta, beta,
APPLY_SPECIFIC(out), APPLY_SPECIFIC(dx),
PyGpuArray_DEV_DATA(*out) PyGpuArray_DEV_DATA(*dx)
); );
cuda_exit(c->ctx); cuda_exit(c->ctx);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论