# Theano TypeError

**URL:** <https://discourse.pymc.io/t/theano-typeerror/1041>\
**Category:** Questions\
**Tags:** from\_github\
**Created:** [April 1, 2018, 1:39pm UTC](https://discourse.pymc.io/t/theano-typeerror/1041 "2018-04-01T13:39:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcio](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@marcio](https://discourse.pymc.io/u/marcio)\
**Post date:** [April 1, 2018, 1:39pm UTC](https://discourse.pymc.io/t/theano-typeerror/1041/1 "2018-04-01T13:39:50Z")

</div>

Hi all, after try to sample I’m receiving this (for every model):

Auto-assigning NUTS sampler…  
Initializing NUTS using jitter+adapt\_diag…  
/usr/local/lib/python3.5/dist-packages/pymc3/model.py:384: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.  
if not np.issubdtype(var.dtype, float):  
Multiprocess sampling (4 chains in 4 jobs)  
NUTS: [beta3, beta2, beta1, intercept\_price, imp, sd\_b1\_log\_\_, nu\_log\_\_, epsilon\_log\_\_, e]  
Process ForkPoolWorker-1:  
Traceback (most recent call last):  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 249, in \_bootstrap  
self.run()  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 93, in run  
self.\_target(\*self.\_args, \*\*self.\_kwargs)  
File “/usr/lib/python3.5/multiprocessing/pool.py”, line 108, in worker  
task = get()  
File “/usr/local/lib/python3.5/dist-packages/joblib/pool.py”, line 362, in get  
return recv()  
File “/usr/lib/python3.5/multiprocessing/connection.py”, line 251, in recv  
return ForkingPickler.loads(buf.getbuffer())  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1082, in \_constructor\_Function  
f = maker.create(input\_storage, trustme=True)  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1715, in create  
input\_storage=input\_storage\_lists, storage\_map=storage\_map)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/link.py”, line 699, in make\_thunk  
storage\_map=storage\_map)[:3]  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/vm.py”, line 1084, in make\_all  
impl=impl))  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 955, in make\_thunk  
no\_recycling)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 833, in make\_c\_thunk  
e = FunctionGraph(node.inputs, node.outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py”, line 137, in **init**  
inputs, outputs = graph.clone(inputs, outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 862, in clone  
equiv = clone\_get\_equiv(i, o, copy\_inputs, copy\_orphans)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 899, in clone\_get\_equiv  
cpy = input.clone()  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 607, in clone  
cp = self. **class** (self.type, self.data, self.name)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/var.py”, line 961, in **init**  
Constant. **init** (self, type, data, name)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 579, in **init**  
self.data = type.filter(data)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/type.py”, line 189, in filter  
“object dtype”, data.dtype)  
TypeError: (‘The following error happened while compiling the node’, Elemwise{Composite{(i0 - (i1 + (i2 \* i3) + (i4 \* i5) + (i6 \* i3) + i7))}}[(0, 1)](TensorConstant{[999. 899…299. 299.]}, AdvancedSubtensor1.0, AdvancedSubtensor1.0, TensorConstant{[31. 5…04. 794.]}, AdvancedSubtensor1.0, TensorConstant{[961. … -24924.]}, AdvancedSubtensor1.0, InplaceDimShuffle{x}.0), ‘\n’, ‘The numpy.ndarray object is not aligned. Theano C code does not support that.’, ‘object buffer\<memory at 0x7f13bb452888\>’, ‘object shape’, (2935849,), ‘object strides’, (8,), ‘object dtype’, dtype(‘float64’))  
Process ForkPoolWorker-2:  
Traceback (most recent call last):  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 249, in \_bootstrap  
self.run()  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 93, in run  
self.\_target(\*self.\_args, \*\*self.\_kwargs)  
File “/usr/lib/python3.5/multiprocessing/pool.py”, line 108, in worker  
task = get()  
File “/usr/local/lib/python3.5/dist-packages/joblib/pool.py”, line 362, in get  
return recv()  
File “/usr/lib/python3.5/multiprocessing/connection.py”, line 251, in recv  
return ForkingPickler.loads(buf.getbuffer())  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1082, in \_constructor\_Function  
f = maker.create(input\_storage, trustme=True)  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1715, in create  
input\_storage=input\_storage\_lists, storage\_map=storage\_map)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/link.py”, line 699, in make\_thunk  
storage\_map=storage\_map)[:3]  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/vm.py”, line 1084, in make\_all  
impl=impl))  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 955, in make\_thunk  
no\_recycling)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 833, in make\_c\_thunk  
e = FunctionGraph(node.inputs, node.outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py”, line 137, in **init**  
inputs, outputs = graph.clone(inputs, outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 862, in clone  
equiv = clone\_get\_equiv(i, o, copy\_inputs, copy\_orphans)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 899, in clone\_get\_equiv  
cpy = input.clone()  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 607, in clone  
cp = self. **class** (self.type, self.data, self.name)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/var.py”, line 961, in **init**  
Constant. **init** (self, type, data, name)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 579, in **init**  
self.data = type.filter(data)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/type.py”, line 189, in filter  
“object dtype”, data.dtype)  
TypeError: (‘The following error happened while compiling the node’, Elemwise{Composite{(i0 - (i1 + (i2 \* i3) + (i4 \* i5) + (i6 \* i3) + i7))}}[(0, 1)](TensorConstant{[999. 899…299. 299.]}, AdvancedSubtensor1.0, AdvancedSubtensor1.0, TensorConstant{[31. 5…04. 794.]}, AdvancedSubtensor1.0, TensorConstant{[961. … -24924.]}, AdvancedSubtensor1.0, InplaceDimShuffle{x}.0), ‘\n’, ‘The numpy.ndarray object is not aligned. Theano C code does not support that.’, ‘object buffer\<memory at 0x7f13bb452888\>’, ‘object shape’, (2935849,), ‘object strides’, (8,), ‘object dtype’, dtype(‘float64’))  
Process ForkPoolWorker-3:  
Traceback (most recent call last):  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 249, in \_bootstrap  
self.run()  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 93, in run  
self.\_target(\*self.\_args, \*\*self.\_kwargs)  
File “/usr/lib/python3.5/multiprocessing/pool.py”, line 108, in worker  
task = get()  
File “/usr/local/lib/python3.5/dist-packages/joblib/pool.py”, line 362, in get  
return recv()  
File “/usr/lib/python3.5/multiprocessing/connection.py”, line 251, in recv  
return ForkingPickler.loads(buf.getbuffer())  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1082, in \_constructor\_Function  
f = maker.create(input\_storage, trustme=True)  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1715, in create  
input\_storage=input\_storage\_lists, storage\_map=storage\_map)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/link.py”, line 699, in make\_thunk  
storage\_map=storage\_map)[:3]  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/vm.py”, line 1084, in make\_all  
impl=impl))  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 955, in make\_thunk  
no\_recycling)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 833, in make\_c\_thunk  
e = FunctionGraph(node.inputs, node.outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py”, line 137, in **init**  
inputs, outputs = graph.clone(inputs, outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 862, in clone  
equiv = clone\_get\_equiv(i, o, copy\_inputs, copy\_orphans)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 899, in clone\_get\_equiv  
cpy = input.clone()

File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 607, in clone  
cp = self. **class** (self.type, self.data, self.name)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/var.py”, line 961, in **init**  
Constant. **init** (self, type, data, name)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 579, in **init**  
self.data = type.filter(data)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/type.py”, line 189, in filter  
“object dtype”, data.dtype)  
TypeError: (‘The following error happened while compiling the node’, Elemwise{Composite{(i0 - (i1 + (i2 \* i3) + (i4 \* i5) + (i6 \* i3) + i7))}}[(0, 1)](TensorConstant{[999. 899…299. 299.]}, AdvancedSubtensor1.0, AdvancedSubtensor1.0, TensorConstant{[31. 5…04. 794.]}, AdvancedSubtensor1.0, TensorConstant{[961. … -24924.]}, AdvancedSubtensor1.0, InplaceDimShuffle{x}.0), ‘\n’, ‘The numpy.ndarray object is not aligned. Theano C code does not support that.’, ‘object buffer\<memory at 0x7f13bb452888\>’, ‘object shape’, (2935849,), ‘object strides’, (8,), ‘object dtype’, dtype(‘float64’))  
Process ForkPoolWorker-4:  
Traceback (most recent call last):  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 249, in \_bootstrap  
self.run()  
File “/usr/lib/python3.5/multiprocessing/process.py”, line 93, in run  
self.\_target(\*self.\_args, \*\*self.\_kwargs)  
File “/usr/lib/python3.5/multiprocessing/pool.py”, line 108, in worker  
task = get()  
File “/usr/local/lib/python3.5/dist-packages/joblib/pool.py”, line 362, in get  
return recv()  
File “/usr/lib/python3.5/multiprocessing/connection.py”, line 251, in recv  
return ForkingPickler.loads(buf.getbuffer())  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1082, in \_constructor\_Function  
f = maker.create(input\_storage, trustme=True)  
File “/usr/local/lib/python3.5/dist-packages/theano/compile/function\_module.py”, line 1715, in create  
input\_storage=input\_storage\_lists, storage\_map=storage\_map)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/link.py”, line 699, in make\_thunk  
storage\_map=storage\_map)[:3]  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/vm.py”, line 1084, in make\_all  
impl=impl))  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 955, in make\_thunk  
no\_recycling)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/op.py”, line 833, in make\_c\_thunk  
e = FunctionGraph(node.inputs, node.outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py”, line 137, in **init**  
inputs, outputs = graph.clone(inputs, outputs)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 862, in clone  
equiv = clone\_get\_equiv(i, o, copy\_inputs, copy\_orphans)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 899, in clone\_get\_equiv  
cpy = input.clone()  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 607, in clone  
cp = self. **class** (self.type, self.data, self.name)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/var.py”, line 961, in **init**  
Constant. **init** (self, type, data, name)  
File “/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py”, line 579, in **init**  
self.data = type.filter(data)  
File “/usr/local/lib/python3.5/dist-packages/theano/tensor/type.py”, line 189, in filter  
“object dtype”, data.dtype)  
TypeError: (‘The following error happened while compiling the node’, Elemwise{Composite{(i0 - (i1 + (i2 \* i3) + (i4 \* i5) + (i6 \* i3) + i7))}}[(0, 1)](TensorConstant{[999. 899…299. 299.]}, AdvancedSubtensor1.0, AdvancedSubtensor1.0, TensorConstant{[31. 5…04. 794.]}, AdvancedSubtensor1.0, TensorConstant{[961. … -24924.]}, AdvancedSubtensor1.0, InplaceDimShuffle{x}.0), ‘\n’, ‘The numpy.ndarray object is not aligned. Theano C code does not support that.’, ‘object buffer\<memory at 0x7f13bb452888\>’, ‘object shape’, (2935849,), ‘object strides’, (8,), ‘object dtype’, dtype(‘float64’))

Thank you all!

## Versions and main components

- PyMC3 Version: 3.3.2
- Theano Version: 1.01
- Python Version: 3.5
- Operating system: Ubuntu 16.04
- How did you install PyMC3: pip

---

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [April 1, 2018, 4:13pm UTC](https://discourse.pymc.io/t/theano-typeerror/1041/2 "2018-04-01T16:13:25Z")

</div>

Following github issue [https://github.com/pymc-devs/pymc3/issues/2913](https://github.com/pymc-devs/pymc3/issues/2913)  
What is the size of your model (number of data point, number or parameters). I think it is running out of memory.

---

<div class="post-metadata">

**Author:** ![Jihad](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@Jihad](https://discourse.pymc.io/u/Jihad)\
**Post date:** [December 5, 2021, 3:06am UTC](https://discourse.pymc.io/t/theano-typeerror/1041/3 "2021-12-05T03:06:36Z")

</div>

Hi I am getting an error similar to this,

```auto
Exception: ('The following error happened while compiling the node', CGemv{inplace}(AllocEmpty{dtype='float64'}.0, TensorConstant{1.0}, Reshape{2}.0, Elemwise{Composite{((i0 * i1) / i2)}}[(0, 1)].0, TensorConstant{0.0}), '\n', "Compilation failed (return status=1): <command-line>:0:1: error: macro names must be identifiers\r. cc1plus.exe: warning: unrecognized command line option '-Wno-c++11-narrowing'\r. ", 'FunctionGraph(CGemv{inplace}(<TensorType(float64, vector)>, TensorConstant{1.0}, <TensorType(float64, matrix)>, <TensorType(float64, vector)>, TensorConstant{0.0}))')

```

I am not sure how to check the size of my data, but if it was running out of memory how could I fix this. Thanks.
