Keras on theano is giving this error. Help!

===============================
00001    #include <Python.h>
00002    #include <iostream>
00003    #include "theano_mod_helper.h"
00004    #include <math.h>
00005    #include <numpy/arrayobject.h>
00006    #include <numpy/arrayscalars.h>
00007    //////////////////////
00008    ////  Support Code
00009    //////////////////////
00010    
00011        namespace {
00012        struct __struct_compiled_op_0040824c9d256009bbf96cfd9685133e {
00013            PyObject* __ERROR;
00014    
00015            PyObject* storage_V3;
00016    PyObject* storage_V5;
00017    PyObject* storage_V7;
00018    PyObject* storage_V9;
00019    PyObject* storage_V1;
00020            
00021    
00022            __struct_compiled_op_0040824c9d256009bbf96cfd9685133e() {
00023                // This is only somewhat safe because we:
00024                //  1) Are not a virtual class
00025                //  2) Do not use any virtual classes in the members
00026                //  3) Deal with mostly POD and pointers
00027    
00028                // If this changes, we would have to revise this, but 
for
00029                // now I am tired of chasing segfaults because
00030                // initialization code had an error and some pointer 
has
00031                // a junk value.
00032                memset(this, 0, sizeof(*this));
00033            }
00034            
~__struct_compiled_op_0040824c9d256009bbf96cfd9685133e(void) {
00035                cleanup();
00036            }
00037    
00038            int init(PyObject* __ERROR, PyObject* storage_V3, 
PyObject* storage_V5, PyObject* storage_V7, PyObject* storage_V9, PyObject* 
storage_V1) {
00039                Py_XINCREF(storage_V3);
00040    Py_XINCREF(storage_V5);
00041    Py_XINCREF(storage_V7);
00042    Py_XINCREF(storage_V9);
00043    Py_XINCREF(storage_V1);
00044                this->storage_V3 = storage_V3;
00045    this->storage_V5 = storage_V5;
00046    this->storage_V7 = storage_V7;
00047    this->storage_V9 = storage_V9;
00048    this->storage_V1 = storage_V1;
00049                
00050    
00051    
00052    
00053    
00054    
00055    
00056                this->__ERROR = __ERROR;
00057                return 0;
00058            }
00059            void cleanup(void) {
00060                __label_1:
00061    
00062    double __DUMMY_1;
00063    __label_3:
00064    
00065    double __DUMMY_3;
00066    __label_5:
00067    
00068    double __DUMMY_5;
00069    __label_7:
00070    
00071    double __DUMMY_7;
00072    __label_9:
00073    
00074    double __DUMMY_9;
00075    __label_12:
00076    
00077    double __DUMMY_12;
00078    
00079                Py_XDECREF(this->storage_V3);
00080    Py_XDECREF(this->storage_V5);
00081    Py_XDECREF(this->storage_V7);
00082    Py_XDECREF(this->storage_V9);
00083    Py_XDECREF(this->storage_V1);
00084            }
00085            int run(void) {
00086                int __failure = 0;
00087                
00088        PyObject* py_V1;
00089        
00090            PyArrayObject* V1;
00091            
00092                typedef npy_float32 dtype_V1;
00093                
00094        PyObject* py_V3;
00095        
00096            PyArrayObject* V3;
00097            
00098                typedef npy_float32 dtype_V3;
00099                
00100        PyObject* py_V5;
00101        
00102            PyArrayObject* V5;
00103            
00104                typedef npy_int16 dtype_V5;
00105                
00106        PyObject* py_V7;
00107        
00108            PyArrayObject* V7;
00109            
00110                typedef npy_int64 dtype_V7;
00111                
00112        PyObject* py_V9;
00113        
00114            PyArrayObject* V9;
00115            
00116                typedef npy_int64 dtype_V9;
00117                
00118    {
00119    
00120        py_V1 = PyList_GET_ITEM(storage_V1, 0);
00121        {Py_XINCREF(py_V1);}
00122        
00123            if (py_V1 == Py_None)
00124            {
00125                
00126            V1 = NULL;
00127            
00128            }
00129            else
00130            {
00131                
00132                V1 = NULL;
00133                if (py_V1 == Py_None) {
00134                    // We can either fail here or set V1 to NULL and 
rely on Ops
00135                    // using tensors to handle the NULL case, but if 
they fail to do so
00136                    // they'll end up with nasty segfaults, so this is 
public service.
00137                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray, not None");
00138                    {
00139            __failure = 2;
00140            if (!PyErr_Occurred()) {
00141                PyErr_SetString(PyExc_RuntimeError,
00142                    "Unexpected error in an Op's C code. "
00143                    "No Python exception was set.");
00144                }
00145            goto __label_2;}
00146                }
00147                if (!PyArray_Check(py_V1)) {
00148                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray");
00149                    {
00150            __failure = 2;
00151            if (!PyErr_Occurred()) {
00152                PyErr_SetString(PyExc_RuntimeError,
00153                    "Unexpected error in an Op's C code. "
00154                    "No Python exception was set.");
00155                }
00156            goto __label_2;}
00157                }
00158                // We expect NPY_FLOAT32
00159                if (!PyArray_ISALIGNED((PyArrayObject*) py_V1)) {
00160                    PyArrayObject * tmp = (PyArrayObject*) py_V1;
00161                    PyErr_Format(PyExc_NotImplementedError,
00162                                 "expected an aligned array of type 
%ld "
00163                                 "(NPY_FLOAT32), got non-aligned array 
of type %ld"
00164                                 " with %ld dimensions, with 3 last 
dims "
00165                                 "%ld, %ld, %ld"
00166                                 " and 3 last strides %ld %ld, %ld.",
00167                                 (long int) NPY_FLOAT32,
00168                                 (long int) 
PyArray_TYPE((PyArrayObject*) py_V1),
00169                                 (long int) PyArray_NDIM(tmp),
00170                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00171                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
00172                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00173                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
00174                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00175                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
00176                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00177                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
00178                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00179                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
00180                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00181                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
00182                );
00183                    {
00184            __failure = 2;
00185            if (!PyErr_Occurred()) {
00186                PyErr_SetString(PyExc_RuntimeError,
00187                    "Unexpected error in an Op's C code. "
00188                    "No Python exception was set.");
00189                }
00190            goto __label_2;}
00191                }
00192                // This is a TypeError to be consistent with DEBUG_MODE
00193                // Note: DEBUG_MODE also tells the name of the 
container
00194                if (PyArray_TYPE((PyArrayObject*) py_V1) != 
NPY_FLOAT32) {
00195                    PyErr_Format(PyExc_TypeError,
00196                                 "expected type_num %d (NPY_FLOAT32) 
got %d",
00197                                 NPY_FLOAT32, 
PyArray_TYPE((PyArrayObject*) py_V1));
00198                    {
00199            __failure = 2;
00200            if (!PyErr_Occurred()) {
00201                PyErr_SetString(PyExc_RuntimeError,
00202                    "Unexpected error in an Op's C code. "
00203                    "No Python exception was set.");
00204                }
00205            goto __label_2;}
00206                }
00207                
00208            V1 = (PyArrayObject*)(py_V1);
00209            Py_XINCREF(V1);
00210            
00211            }
00212            
00213    {
00214    
00215        py_V3 = PyList_GET_ITEM(storage_V3, 0);
00216        {Py_XINCREF(py_V3);}
00217        
00218                V3 = NULL;
00219                if (py_V3 == Py_None) {
00220                    // We can either fail here or set V3 to NULL and 
rely on Ops
00221                    // using tensors to handle the NULL case, but if 
they fail to do so
00222                    // they'll end up with nasty segfaults, so this is 
public service.
00223                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray, not None");
00224                    {
00225            __failure = 4;
00226            if (!PyErr_Occurred()) {
00227                PyErr_SetString(PyExc_RuntimeError,
00228                    "Unexpected error in an Op's C code. "
00229                    "No Python exception was set.");
00230                }
00231            goto __label_4;}
00232                }
00233                if (!PyArray_Check(py_V3)) {
00234                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray");
00235                    {
00236            __failure = 4;
00237            if (!PyErr_Occurred()) {
00238                PyErr_SetString(PyExc_RuntimeError,
00239                    "Unexpected error in an Op's C code. "
00240                    "No Python exception was set.");
00241                }
00242            goto __label_4;}
00243                }
00244                // We expect NPY_FLOAT32
00245                if (!PyArray_ISALIGNED((PyArrayObject*) py_V3)) {
00246                    PyArrayObject * tmp = (PyArrayObject*) py_V3;
00247                    PyErr_Format(PyExc_NotImplementedError,
00248                                 "expected an aligned array of type 
%ld "
00249                                 "(NPY_FLOAT32), got non-aligned array 
of type %ld"
00250                                 " with %ld dimensions, with 3 last 
dims "
00251                                 "%ld, %ld, %ld"
00252                                 " and 3 last strides %ld %ld, %ld.",
00253                                 (long int) NPY_FLOAT32,
00254                                 (long int) 
PyArray_TYPE((PyArrayObject*) py_V3),
00255                                 (long int) PyArray_NDIM(tmp),
00256                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00257                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
00258                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00259                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
00260                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00261                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
00262                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00263                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
00264                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00265                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
00266                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00267                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
00268                );
00269                    {
00270            __failure = 4;
00271            if (!PyErr_Occurred()) {
00272                PyErr_SetString(PyExc_RuntimeError,
00273                    "Unexpected error in an Op's C code. "
00274                    "No Python exception was set.");
00275                }
00276            goto __label_4;}
00277                }
00278                // This is a TypeError to be consistent with DEBUG_MODE
00279                // Note: DEBUG_MODE also tells the name of the 
container
00280                if (PyArray_TYPE((PyArrayObject*) py_V3) != 
NPY_FLOAT32) {
00281                    PyErr_Format(PyExc_TypeError,
00282                                 "expected type_num %d (NPY_FLOAT32) 
got %d",
00283                                 NPY_FLOAT32, 
PyArray_TYPE((PyArrayObject*) py_V3));
00284                    {
00285            __failure = 4;
00286            if (!PyErr_Occurred()) {
00287                PyErr_SetString(PyExc_RuntimeError,
00288                    "Unexpected error in an Op's C code. "
00289                    "No Python exception was set.");
00290                }
00291            goto __label_4;}
00292                }
00293                
00294            V3 = (PyArrayObject*)(py_V3);
00295            Py_XINCREF(V3);
00296            
00297    {
00298    
00299        py_V5 = PyList_GET_ITEM(storage_V5, 0);
00300        {Py_XINCREF(py_V5);}
00301        
00302                V5 = NULL;
00303                if (py_V5 == Py_None) {
00304                    // We can either fail here or set V5 to NULL and 
rely on Ops
00305                    // using tensors to handle the NULL case, but if 
they fail to do so
00306                    // they'll end up with nasty segfaults, so this is 
public service.
00307                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray, not None");
00308                    {
00309            __failure = 6;
00310            if (!PyErr_Occurred()) {
00311                PyErr_SetString(PyExc_RuntimeError,
00312                    "Unexpected error in an Op's C code. "
00313                    "No Python exception was set.");
00314                }
00315            goto __label_6;}
00316                }
00317                if (!PyArray_Check(py_V5)) {
00318                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray");
00319                    {
00320            __failure = 6;
00321            if (!PyErr_Occurred()) {
00322                PyErr_SetString(PyExc_RuntimeError,
00323                    "Unexpected error in an Op's C code. "
00324                    "No Python exception was set.");
00325                }
00326            goto __label_6;}
00327                }
00328                // We expect NPY_INT16
00329                if (!PyArray_ISALIGNED((PyArrayObject*) py_V5)) {
00330                    PyArrayObject * tmp = (PyArrayObject*) py_V5;
00331                    PyErr_Format(PyExc_NotImplementedError,
00332                                 "expected an aligned array of type 
%ld "
00333                                 "(NPY_INT16), got non-aligned array 
of type %ld"
00334                                 " with %ld dimensions, with 3 last 
dims "
00335                                 "%ld, %ld, %ld"
00336                                 " and 3 last strides %ld %ld, %ld.",
00337                                 (long int) NPY_INT16,
00338                                 (long int) 
PyArray_TYPE((PyArrayObject*) py_V5),
00339                                 (long int) PyArray_NDIM(tmp),
00340                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00341                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
00342                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00343                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
00344                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00345                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
00346                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00347                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
00348                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00349                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
00350                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00351                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
00352                );
00353                    {
00354            __failure = 6;
00355            if (!PyErr_Occurred()) {
00356                PyErr_SetString(PyExc_RuntimeError,
00357                    "Unexpected error in an Op's C code. "
00358                    "No Python exception was set.");
00359                }
00360            goto __label_6;}
00361                }
00362                // This is a TypeError to be consistent with DEBUG_MODE
00363                // Note: DEBUG_MODE also tells the name of the 
container
00364                if (PyArray_TYPE((PyArrayObject*) py_V5) != NPY_INT16) 
{
00365                    PyErr_Format(PyExc_TypeError,
00366                                 "expected type_num %d (NPY_INT16) got 
%d",
00367                                 NPY_INT16, 
PyArray_TYPE((PyArrayObject*) py_V5));
00368                    {
00369            __failure = 6;
00370            if (!PyErr_Occurred()) {
00371                PyErr_SetString(PyExc_RuntimeError,
00372                    "Unexpected error in an Op's C code. "
00373                    "No Python exception was set.");
00374                }
00375            goto __label_6;}
00376                }
00377                
00378            V5 = (PyArrayObject*)(py_V5);
00379            Py_XINCREF(V5);
00380            
00381    {
00382    
00383        py_V7 = PyList_GET_ITEM(storage_V7, 0);
00384        {Py_XINCREF(py_V7);}
00385        
00386                V7 = NULL;
00387                if (py_V7 == Py_None) {
00388                    // We can either fail here or set V7 to NULL and 
rely on Ops
00389                    // using tensors to handle the NULL case, but if 
they fail to do so
00390                    // they'll end up with nasty segfaults, so this is 
public service.
00391                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray, not None");
00392                    {
00393            __failure = 8;
00394            if (!PyErr_Occurred()) {
00395                PyErr_SetString(PyExc_RuntimeError,
00396                    "Unexpected error in an Op's C code. "
00397                    "No Python exception was set.");
00398                }
00399            goto __label_8;}
00400                }
00401                if (!PyArray_Check(py_V7)) {
00402                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray");
00403                    {
00404            __failure = 8;
00405            if (!PyErr_Occurred()) {
00406                PyErr_SetString(PyExc_RuntimeError,
00407                    "Unexpected error in an Op's C code. "
00408                    "No Python exception was set.");
00409                }
00410            goto __label_8;}
00411                }
00412                // We expect NPY_INT64
00413                if (!PyArray_ISALIGNED((PyArrayObject*) py_V7)) {
00414                    PyArrayObject * tmp = (PyArrayObject*) py_V7;
00415                    PyErr_Format(PyExc_NotImplementedError,
00416                                 "expected an aligned array of type 
%ld "
00417                                 "(NPY_INT64), got non-aligned array 
of type %ld"
00418                                 " with %ld dimensions, with 3 last 
dims "
00419                                 "%ld, %ld, %ld"
00420                                 " and 3 last strides %ld %ld, %ld.",
00421                                 (long int) NPY_INT64,
00422                                 (long int) 
PyArray_TYPE((PyArrayObject*) py_V7),
00423                                 (long int) PyArray_NDIM(tmp),
00424                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00425                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
00426                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00427                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
00428                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00429                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
00430                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00431                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
00432                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00433                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
00434                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00435                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
00436                );
00437                    {
00438            __failure = 8;
00439            if (!PyErr_Occurred()) {
00440                PyErr_SetString(PyExc_RuntimeError,
00441                    "Unexpected error in an Op's C code. "
00442                    "No Python exception was set.");
00443                }
00444            goto __label_8;}
00445                }
00446                // This is a TypeError to be consistent with DEBUG_MODE
00447                // Note: DEBUG_MODE also tells the name of the 
container
00448                if (PyArray_TYPE((PyArrayObject*) py_V7) != NPY_INT64) 
{
00449                    PyErr_Format(PyExc_TypeError,
00450                                 "expected type_num %d (NPY_INT64) got 
%d",
00451                                 NPY_INT64, 
PyArray_TYPE((PyArrayObject*) py_V7));
00452                    {
00453            __failure = 8;
00454            if (!PyErr_Occurred()) {
00455                PyErr_SetString(PyExc_RuntimeError,
00456                    "Unexpected error in an Op's C code. "
00457                    "No Python exception was set.");
00458                }
00459            goto __label_8;}
00460                }
00461                
00462            V7 = (PyArrayObject*)(py_V7);
00463            Py_XINCREF(V7);
00464            
00465    {
00466    
00467        py_V9 = PyList_GET_ITEM(storage_V9, 0);
00468        {Py_XINCREF(py_V9);}
00469        
00470                V9 = NULL;
00471                if (py_V9 == Py_None) {
00472                    // We can either fail here or set V9 to NULL and 
rely on Ops
00473                    // using tensors to handle the NULL case, but if 
they fail to do so
00474                    // they'll end up with nasty segfaults, so this is 
public service.
00475                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray, not None");
00476                    {
00477            __failure = 10;
00478            if (!PyErr_Occurred()) {
00479                PyErr_SetString(PyExc_RuntimeError,
00480                    "Unexpected error in an Op's C code. "
00481                    "No Python exception was set.");
00482                }
00483            goto __label_10;}
00484                }
00485                if (!PyArray_Check(py_V9)) {
00486                    PyErr_SetString(PyExc_ValueError, "expected an 
ndarray");
00487                    {
00488            __failure = 10;
00489            if (!PyErr_Occurred()) {
00490                PyErr_SetString(PyExc_RuntimeError,
00491                    "Unexpected error in an Op's C code. "
00492                    "No Python exception was set.");
00493                }
00494            goto __label_10;}
00495                }
00496                // We expect NPY_INT64
00497                if (!PyArray_ISALIGNED((PyArrayObject*) py_V9)) {
00498                    PyArrayObject * tmp = (PyArrayObject*) py_V9;
00499                    PyErr_Format(PyExc_NotImplementedError,
00500                                 "expected an aligned array of type 
%ld "
00501                                 "(NPY_INT64), got non-aligned array 
of type %ld"
00502                                 " with %ld dimensions, with 3 last 
dims "
00503                                 "%ld, %ld, %ld"
00504                                 " and 3 last strides %ld %ld, %ld.",
00505                                 (long int) NPY_INT64,
00506                                 (long int) 
PyArray_TYPE((PyArrayObject*) py_V9),
00507                                 (long int) PyArray_NDIM(tmp),
00508                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00509                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-3] : -1),
00510                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00511                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-2] : -1),
00512                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00513                PyArray_DIMS(tmp)[PyArray_NDIM(tmp)-1] : -1),
00514                                 (long int) (PyArray_NDIM(tmp) >= 3 ?
00515                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-3] : -1),
00516                                 (long int) (PyArray_NDIM(tmp) >= 2 ?
00517                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-2] : -1),
00518                                 (long int) (PyArray_NDIM(tmp) >= 1 ?
00519                PyArray_STRIDES(tmp)[PyArray_NDIM(tmp)-1] : -1)
00520                );
00521                    {
00522            __failure = 10;
00523            if (!PyErr_Occurred()) {
00524                PyErr_SetString(PyExc_RuntimeError,
00525                    "Unexpected error in an Op's C code. "
00526                    "No Python exception was set.");
00527                }
00528            goto __label_10;}
00529                }
00530                // This is a TypeError to be consistent with DEBUG_MODE
00531                // Note: DEBUG_MODE also tells the name of the 
container
00532                if (PyArray_TYPE((PyArrayObject*) py_V9) != NPY_INT64) 
{
00533                    PyErr_Format(PyExc_TypeError,
00534                                 "expected type_num %d (NPY_INT64) got 
%d",
00535                                 NPY_INT64, 
PyArray_TYPE((PyArrayObject*) py_V9));
00536                    {
00537            __failure = 10;
00538            if (!PyErr_Occurred()) {
00539                PyErr_SetString(PyExc_RuntimeError,
00540                    "Unexpected error in an Op's C code. "
00541                    "No Python exception was set.");
00542                }
00543            goto __label_10;}
00544                }
00545                
00546            V9 = (PyArrayObject*)(py_V9);
00547            Py_XINCREF(V9);
00548            
00549    {
00550    // Op class Alloc
00551    
00552                npy_intp shape[3];
00553                
00554                    shape[0] = ((dtype_V5*) PyArray_DATA(V5))[0];
00555                    
00556                    shape[1] = ((dtype_V7*) PyArray_DATA(V7))[0];
00557                    
00558                    shape[2] = ((dtype_V9*) PyArray_DATA(V9))[0];
00559                    
00560                int need_new_out = (NULL == V1);
00561                for (int i = 0; i < 3; i++)
00562                    need_new_out = (need_new_out
00563                                    || (PyArray_DIMS(V1)[i] != 
shape[i]));
00564    
00565                if (need_new_out)
00566                {
00567                    Py_XDECREF(V1);
00568                    V1 = (PyArrayObject*) PyArray_SimpleNew(3,
00569                        shape, PyArray_TYPE((PyArrayObject*) py_V3));
00570                    if (!V1)
00571                    {
00572                        PyErr_SetString(PyExc_MemoryError, "alloc 
failed");
00573                        {
00574            __failure = 11;
00575            if (!PyErr_Occurred()) {
00576                PyErr_SetString(PyExc_RuntimeError,
00577                    "Unexpected error in an Op's C code. "
00578                    "No Python exception was set.");
00579                }
00580            goto __label_11;}
00581                    }
00582                }
00583    
00584                // This function takes care of broadcasting
00585                if (PyArray_CopyInto(V1, V3) == -1)
00586                  {
00587            __failure = 11;
00588            if (!PyErr_Occurred()) {
00589                PyErr_SetString(PyExc_RuntimeError,
00590                    "Unexpected error in an Op's C code. "
00591                    "No Python exception was set.");
00592                }
00593            goto __label_11;}
00594                __label_11:
00595    
00596    double __DUMMY_11;
00597    
00598    }
00599    __label_10:
00600    
00601            if (V9) {
00602                Py_XDECREF(V9);
00603            }
00604            
00605        {Py_XDECREF(py_V9);}
00606        
00607    double __DUMMY_10;
00608    
00609    }
00610    __label_8:
00611    
00612            if (V7) {
00613                Py_XDECREF(V7);
00614            }
00615            
00616        {Py_XDECREF(py_V7);}
00617        
00618    double __DUMMY_8;
00619    
00620    }
00621    __label_6:
00622    
00623            if (V5) {
00624                Py_XDECREF(V5);
00625            }
00626            
00627        {Py_XDECREF(py_V5);}
00628        
00629    double __DUMMY_6;
00630    
00631    }
00632    __label_4:
00633    
00634            if (V3) {
00635                Py_XDECREF(V3);
00636            }
00637            
00638        {Py_XDECREF(py_V3);}
00639        
00640    double __DUMMY_4;
00641    
00642    }
00643    __label_2:
00644    
00645        if (!__failure) {
00646          
00647            {Py_XDECREF(py_V1);}
00648            if (!V1) {
00649                Py_INCREF(Py_None);
00650                py_V1 = Py_None;
00651            }
00652            else if ((void*)py_V1 != (void*)V1) {
00653                py_V1 = (PyObject*)V1;
00654            }
00655    
00656            {Py_XINCREF(py_V1);}
00657    
00658            if (V1 && !PyArray_ISALIGNED((PyArrayObject*) py_V1)) {
00659                PyErr_Format(PyExc_NotImplementedError,
00660                             "c_sync: expected an aligned array, got 
non-aligned array of type %ld"
00661                             " with %ld dimensions, with 3 last dims "
00662                             "%ld, %ld, %ld"
00663                             " and 3 last strides %ld %ld, %ld.",
00664                             (long int) PyArray_TYPE((PyArrayObject*) 
py_V1),
00665                             (long int) PyArray_NDIM(V1),
00666                             (long int) (PyArray_NDIM(V1) >= 3 ?
00667            PyArray_DIMS(V1)[PyArray_NDIM(V1)-3] : -1),
00668                             (long int) (PyArray_NDIM(V1) >= 2 ?
00669            PyArray_DIMS(V1)[PyArray_NDIM(V1)-2] : -1),
00670                             (long int) (PyArray_NDIM(V1) >= 1 ?
00671            PyArray_DIMS(V1)[PyArray_NDIM(V1)-1] : -1),
00672                             (long int) (PyArray_NDIM(V1) >= 3 ?
00673            PyArray_STRIDES(V1)[PyArray_NDIM(V1)-3] : -1),
00674                             (long int) (PyArray_NDIM(V1) >= 2 ?
00675            PyArray_STRIDES(V1)[PyArray_NDIM(V1)-2] : -1),
00676                             (long int) (PyArray_NDIM(V1) >= 1 ?
00677            PyArray_STRIDES(V1)[PyArray_NDIM(V1)-1] : -1)
00678            );
00679                {
00680            __failure = 2;
00681            if (!PyErr_Occurred()) {
00682                PyErr_SetString(PyExc_RuntimeError,
00683                    "Unexpected error in an Op's C code. "
00684                    "No Python exception was set.");
00685                }
00686            goto __label_2;}
00687            }
00688            
00689          PyObject* old = PyList_GET_ITEM(storage_V1, 0);
00690          {Py_XINCREF(py_V1);}
00691          PyList_SET_ITEM(storage_V1, 0, py_V1);
00692          {Py_XDECREF(old);}
00693        }
00694        
00695            if (V1) {
00696                Py_XDECREF(V1);
00697            }
00698            
00699        {Py_XDECREF(py_V1);}
00700        
00701    double __DUMMY_2;
00702    
00703    }
00704    
00705                
00706            if (__failure) {
00707                // When there is a failure, this code puts the 
exception
00708                // in __ERROR.
00709                PyObject* err_type = NULL;
00710                PyObject* err_msg = NULL;
00711                PyObject* err_traceback = NULL;
00712                PyErr_Fetch(&err_type, &err_msg, &err_traceback);
00713                if (!err_type) {err_type = Py_None;Py_INCREF(Py_None);}
00714                if (!err_msg) {err_msg = Py_None; Py_INCREF(Py_None);}
00715                if (!err_traceback) {err_traceback = Py_None; 
Py_INCREF(Py_None);}
00716                PyObject* old_err_type = PyList_GET_ITEM(__ERROR, 0);
00717                PyObject* old_err_msg = PyList_GET_ITEM(__ERROR, 1);
00718                PyObject* old_err_traceback = PyList_GET_ITEM(__ERROR, 
2);
00719                PyList_SET_ITEM(__ERROR, 0, err_type);
00720                PyList_SET_ITEM(__ERROR, 1, err_msg);
00721                PyList_SET_ITEM(__ERROR, 2, err_traceback);
00722                {Py_XDECREF(old_err_type);}
00723                {Py_XDECREF(old_err_msg);}
00724                {Py_XDECREF(old_err_traceback);}
00725            }
00726            // The failure code is returned to index what code block 
failed.
00727            return __failure;
00728            
00729            }
00730        };
00731        }
00732        
00733    
00734            static int 
__struct_compiled_op_0040824c9d256009bbf96cfd9685133e_executor(__struct_compiled_op_0040824c9d256009bbf96cfd9685133e*
 
self) {
00735                return self->run();
00736            }
00737    
00738            static void 
__struct_compiled_op_0040824c9d256009bbf96cfd9685133e_destructor(void* 
executor, void* self) {
00739                delete 
((__struct_compiled_op_0040824c9d256009bbf96cfd9685133e*)self);
00740            }
00741            
00742    //////////////////////
00743    ////  Functions
00744    //////////////////////
00745    static PyObject * instantiate(PyObject * self, PyObject *argtuple) 
{
00746      assert(PyTuple_Check(argtuple));
00747      if (6 != PyTuple_Size(argtuple)){ 
00748         PyErr_Format(PyExc_TypeError, "Wrong number of arguments, 
expected 6, got %i", (int)PyTuple_Size(argtuple));
00749         return NULL;
00750      }
00751      __struct_compiled_op_0040824c9d256009bbf96cfd9685133e* 
struct_ptr = new __struct_compiled_op_0040824c9d256009bbf96cfd9685133e();
00752      if (struct_ptr->init( PyTuple_GET_ITEM(argtuple, 
0),PyTuple_GET_ITEM(argtuple, 1),PyTuple_GET_ITEM(argtuple, 
2),PyTuple_GET_ITEM(argtuple, 3),PyTuple_GET_ITEM(argtuple, 
4),PyTuple_GET_ITEM(argtuple, 5) ) != 0) {
00753        delete struct_ptr;
00754        return NULL;
00755      }
00756      PyObject* thunk = 
PyCObject_FromVoidPtrAndDesc((void*)(&__struct_compiled_op_0040824c9d256009bbf96cfd9685133e_executor),
 
struct_ptr, 
__struct_compiled_op_0040824c9d256009bbf96cfd9685133e_destructor);
00757      return thunk; }
00758    
00759    //////////////////////
00760    ////  Module init
00761    //////////////////////
00762    static PyMethodDef MyMethods[] = {
00763        {"instantiate", instantiate, METH_VARARGS, "undocumented"} ,
00764        {NULL, NULL, 0, NULL}
00765    };
00766    PyMODINIT_FUNC init0040824c9d256009bbf96cfd9685133e(void){
00767       import_array();
00768       (void) Py_InitModule("0040824c9d256009bbf96cfd9685133e", 
MyMethods);
00769    }
00770    
===============================
Problem occurred during compilation with the command line below:
/usr/bin/g++ -shared -g -O3 -fno-math-errno -Wno-unused-label 
-Wno-unused-variable -Wno-write-strings -march=broadwell -mmmx -mno-3dnow 
-msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha 
-mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 
-mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd 
-mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave 
-mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf 
-mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq 
-mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb 
-mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param 
l1-cache-line-size=64 --param l2-cache-size=46080 -mtune=broadwell 
-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC 
-I/usr/local/lib/python2.7/site-packages/numpy/core/include 
-I/usr/local/include/python2.7 
-I/usr/local/lib/python2.7/site-packages/theano/gof -L/usr/local/lib 
-fvisibility=hidden -o 
/home/ubuntu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/tmpy72QOL/0040824c9d256009bbf96cfd9685133e.so
 
/home/ubuntu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.13-64/tmpy72QOL/mod.cpp
 
-lpython2.7

Exception: ('The following error happened while compiling the node', 
Alloc(InplaceDimShuffle{0,x}.0, TensorConstant{128}, Shape_i{0}.0, 
TensorConstant{1}), '\n', 'Compilation failed (return status=-2): ', 
'[Alloc(<TensorType(float32, col)>, TensorConstant{128}, <TensorType(int64, 
scalar)>, TensorConstant{1})]')

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to