aesara
aesara copied to clipboard
Generalize matrix_inverse to work beyond 2d arrays
Thank you for opening a PR!
Here are a few important guidelines and requirements to check before your PR can be merged:
- [X] There is an informative high-level description of the changes. This PR generalizes matrix_inverse function to work beyond 2d arrays
- [ ] The description and/or commit message(s) references the relevant GitHub issue(s).
- [x]
pre-commit
is installed and set up. - [x] The commit messages follow these guidelines.
- [ ] The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR.
- [ ] There are tests covering the changes introduced in the PR.
Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.
If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.
This is pretty neat. Should we add a test for 3d tensors? There should be a MatrixInverse test somewhere hopefully
Edit: They are here https://github.com/aesara-devs/aesara/blob/main/tests/tensor/test_nlinalg.py
Should we add a test for 3d tensors?
On it.
We also have to investigate that note on the docstrings, which suggests we have a rewrite that replaces matrix_inverse with solve.
We should check if that rewrite is still correct. That is, check if it can be applied to >2D inputs and if so make sure it is being applied, or if it cannot (e.g., because solve is only valid for 2D) make sure it does not try to do so.
I think the rewrites the docstrings refer to are here: https://github.com/aesara-devs/aesara/blob/main/aesara/sandbox/linalg/ops.py
And tests for the rewrite: https://github.com/aesara-devs/aesara/blob/main/tests/sandbox/linalg/test_linalg.py
We should probably move those to tensor/linalg_opt.py
, but doesn't have to be done in this PR if you don't want to. I think there might be an issue open for this already.
I am struggling to setup the dev environment locally on MacOS to run the test cases.
I followed dev_start_guide and precisely, these are the minimal steps:
$ conda env create -n aesara-dev-2 -f environment.yml
$ conda activate aesara-dev-2
$ pip install -r requirements.txt
And I cannot import aesara
$ python
Python 3.10.2 | packaged by conda-forge | (main, Feb 1 2022, 19:30:18) [Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import aesara
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sayam/Desktop/open_source/aesara/aesara/__init__.py", line 126, in <module>
from aesara import scalar, tensor
File "/Users/sayam/Desktop/open_source/aesara/aesara/scalar/__init__.py", line 2, in <module>
from .math import *
File "/Users/sayam/Desktop/open_source/aesara/aesara/scalar/math.py", line 11, in <module>
import scipy.special
File "/Users/sayam/miniconda3/envs/aesara-dev-2/lib/python3.10/site-packages/scipy/special/__init__.py", line 633, in <module>
from . import _ufuncs
File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Is this a known issue or am I missing something?
if it cannot (e.g., because solve is only valid for 2D) make sure it does not try to do so.
I think then the Solve
Op also needs to be generalized beyond 2d arrays. On a similar note, Brandon also suggested to update L_Op
method here for generalizing Cholesky
Op which will also involve generalizing Solve
Op beyond 2d arrays.
I had a closer look at the 2 rewrites. The first one is trivial and safe to generalize beyond 2 dimensions
https://github.com/aesara-devs/aesara/blob/2450186216671085d35f2762bb4db849f07e4e0d/aesara/sandbox/linalg/ops.py#L22-L31
We just need to update if node.op.new_order == (1, 0)
which only works for 2D inputs to check for (0, 1, 2..., ndim, ndim-1) (i.e., transpose of the last 2 dimensions)
The second rewrite where solves are introduced is only relevant when there is a dot
or dot22
upstream. If those don't accept >2D inputs (I haven't checked it), then we don't need to worry about them for the time being
https://github.com/aesara-devs/aesara/blob/2450186216671085d35f2762bb4db849f07e4e0d/aesara/sandbox/linalg/ops.py#L35-L36
If they accept, we can just add a temporary check that the MatrixInverse is 2D and a reminder TODO to lift the restriction once Solve supports higher dimensions.
I am struggling to setup the dev environment locally on MacOS to run the test cases.
Were you able to resolve this?
Were you able to resolve this?
No. And I haven't tried setting up the env after the merge of https://github.com/aesara-devs/aesara/pull/812. I'll give it a shot in the coming week.
I successfully created the dev environment and I was able to import aesara. But now I am facing compiler related problems.
Here is the code snippet:
>>> import aesara
>>> import aesara.tensor as at
>>> matrix_1 = at.as_tensor_variable([[1., 2.], [3., 4]])
>>> matrix_2 = at.as_tensor_variable([[5., 6.], [7., 8.]])
>>> (matrix_1 * matrix_2).eval()
Traceback
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error__p711kzq
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1846, in process_node
replacements = lopt.transform(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1051, in transform
return self.fn(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/tensor/basic_opt.py", line 2944, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmptbg_xnlw/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error_bkc1lpbk
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1846, in process_node
replacements = lopt.transform(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1051, in transform
return self.fn(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/tensor/basic_opt.py", line 2944, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmppruqcsvo/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error_glf_arvi
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1846, in process_node
replacements = lopt.transform(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1051, in transform
return self.fn(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/tensor/basic_opt.py", line 2944, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpl2t6tnvs/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error_g57j567u
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1846, in process_node
replacements = lopt.transform(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1051, in transform
return self.fn(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/tensor/basic_opt.py", line 2944, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpac_u_zzj/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error_ghhyij1v
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1846, in process_node
replacements = lopt.transform(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/opt.py", line 1051, in transform
return self.fn(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/tensor/basic_opt.py", line 2944, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmp2qa05d7w/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
You can find the C code in this temporary file: /var/folders/ht/b4r2nlz93qv31tp71vbdb5hm0000gn/T/aesara_compilation_error_691s7zav
Traceback (most recent call last):
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/vm.py", line 1112, in make_all
node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/basic.py", line 541, in eval
self._fn_cache[inputs] = function(inputs, self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/compile/function/__init__.py", line 337, in function
fn = pfunc(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/compile/function/pfunc.py", line 363, in pfunc
return orig_function(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/compile/function/types.py", line 1743, in orig_function
fn = m.create(defaults)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/compile/function/types.py", line 1638, in create
_fn, _i, _o = self.linker.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/basic.py", line 238, in make_thunk
return self.make_all(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/vm.py", line 1121, in make_all
raise_with_op(fgraph, node)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/utils.py", line 517, in raise_with_op
raise exc_value.with_traceback(exc_trace)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/vm.py", line 1112, in make_all
node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 691, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/graph/op.py", line 657, in make_c_thunk
outputs = cl.make_thunk(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 1198, in module_from_key
module = lnk.compile_cmodule(location)
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/cmodule.py", line 2553, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/sayam/miniconda3/envs/aesara-dev-3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=skylake -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/sayam/miniconda3/envs/aesara-dev-3/lib/python3.10/site-packages/numpy/core/include -I/Users/sayam/miniconda3/envs/aesara-dev-3/include/python3.10 -I/Users/sayam/Desktop/open_source/Theano-PyMC/aesara/link/c/c_code -L/Users/sayam/miniconda3/envs/aesara-dev-3/lib -fvisibility=hidden -o /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/m9ed7f5244c2b93cacce110a51ffbd760b0bae5b2e6c52e17f4f114e1f785bddb.so /Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:27: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:27: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:34: error: non-constant-expression cannot be narrowed from type 'npy_intp' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:572:34: note: insert an explicit cast to silence this issue
int init_totals[2] = {V5_n0, V5_n1};
^~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:9: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:9: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:21: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V5_stride0, V5_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:584:21: note: insert an explicit cast to silence this issue
V5_stride0, V5_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:1: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V3_stride0, V3_stride1,
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:585:13: note: insert an explicit cast to silence this issue
V3_stride0, V3_stride1,
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:1: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:1: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:13: error: non-constant-expression cannot be narrowed from type 'ssize_t' (aka 'long') to 'int' in initializer list [-Wc++11-narrowing]
V1_stride0, V1_stride1
^~~~~~~~~~
/Users/sayam/.aesara/compiledir_macOS-12.1-x86_64-i386-64bit-i386-3.10.2-64/tmpcifx17vl/mod.cpp:586:13: note: insert an explicit cast to silence this issue
V1_stride0, V1_stride1
^~~~~~~~~~
static_cast<int>( )
8 errors generated.
Apply node that caused the error: Elemwise{mul,no_inplace}(TensorConstant{[[1. 2.]
[3. 4.]]}, TensorConstant{[[5. 6.]
[7. 8.]]})
Toposort index: 0
Inputs types: [TensorType(float64, (2, 2)), TensorType(float64, (2, 2))]
Backtrace when the node is created (use Aesara flag traceback__limit=N to make it longer):
File "<stdin>", line 1, in <module>
HINT: Use a linker other than the C linker to print the inputs' shapes and strides.
HINT: Use the Aesara flag `exception_verbosity=high` for a debug print-out and storage map footprint of this Apply node.
Did you try setting -Wc++11-narrowing
in .aesararc
?
Did you try setting -Wc++11-narrowing in .aesararc?
I added the following in ~/.aesararc
as also recommended in issue https://github.com/aesara-devs/aesara/issues/127
[gcc]
cxxflags = -Wno-c++11-narrowing
And this worked. Thanks