comparison nnet_ops.py @ 68:315eb36ff954

fixed typo in crossentropy_dx.c_code
author bergstra@is23.m
date Fri, 18 Apr 2008 03:49:17 -0400
parents 810a8e3c85e1
children 8c2607f387e6
comparison
equal deleted inserted replaced
67:810a8e3c85e1 68:315eb36ff954
257 { 257 {
258 PyErr_SetString(PyExc_ValueError, "rank error"); 258 PyErr_SetString(PyExc_ValueError, "rank error");
259 %(fail)s; 259 %(fail)s;
260 } 260 }
261 if ((%(dnll)s->dimensions[0] != %(sm)s->dimensions[0]) 261 if ((%(dnll)s->dimensions[0] != %(sm)s->dimensions[0])
262 || (%(dnll)s->dimensions[0] != %(y_idx)s->dimensions[0]) 262 || (%(dnll)s->dimensions[0] != %(y_idx)s->dimensions[0]))
263 || (%(dnll)s->dimensions[0] != %(dx)s->dimensions[0]))
264 { 263 {
265 PyErr_SetString(PyExc_ValueError, "dimension mismatch"); 264 PyErr_SetString(PyExc_ValueError, "dimension mismatch");
266 %(fail)s; 265 %(fail)s;
267 } 266 }
268 if ((NULL == %(dx)s) 267 if ((NULL == %(dx)s)
269 || (%(dx)s->dimensions[0] != %(sm)s->dimensions[0]) 268 || (%(dx)s->dimensions[0] != %(sm)s->dimensions[0])
270 || (%(dx)s->dimensions[1] != %(sm)s->dimensions[1])) 269 || (%(dx)s->dimensions[1] != %(sm)s->dimensions[1]))
271 { 270 {
272 if (NULL != %(dx)s) Py_XDECREF(%(dx)s); 271 if (NULL != %(dx)s) Py_XDECREF(%(dx)s);
273 %(dx)s = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(%(x)s), type_num_%(x)s); 272 %(dx)s = (PyArrayObject*)PyArray_SimpleNew(2, PyArray_DIMS(%(sm)s), type_num_%(sm)s);
274 if(!%(dx)s) { 273 if(!%(dx)s) {
275 // The normal cleanup code will take care of %(nll)s
276 // Py_XDECREF(%(nll)s); %(nll)s=NULL;
277 PyErr_SetString(PyExc_MemoryError, "failed to alloc dx output"); 274 PyErr_SetString(PyExc_MemoryError, "failed to alloc dx output");
278 %(fail)s 275 %(fail)s
279 } 276 }
280 } 277 }
281 278