pymc-devs / pymc

Bayesian Modeling and Probabilistic Programming in Python
https://docs.pymc.io/
Other
8.72k stars 2.01k forks source link

Pymc3_3.11.3 and Pymc3 V4: Hierarchical Model fails with Two Different types of Error on the same data and model specifications #4964

Closed sreedat closed 3 years ago

sreedat commented 3 years ago

Data and Model Description: Setting up a basic Hierarchical model of Weekly Sales as a function of weekly RepVisits and Samples among 10 regions. The data set has 52 weeks of data for each region. Five columns of data: id : Region ID from 1 to 10 weeks : Week numbers from 1 to 52 sales : Weekly regional sales repvisits : Number of weekly field rep visits to certain stores samples : Number of trial samples taken during Demos by customers

Note: Sales, RepVisits, and Samples are captured as Real / Float in the dataset and not as Integers

Version Information: pymc3 : 3.11.3 OS : Windows 10 64-bit Python : 3.9.6 via Anaconda3-2021.05-Windows-x86_64 theano-pymc : 1.1.2 pymc3 install via : pip install pymc3 gcc 8.3.0 : via RTools mingw compiler tool set / did not use m2w64-toolchain as theano-pymc fails

Reproducible code - I do not know how to attach my data (in a CSV format) if you let me know I can share it. Rest of the code and the error and complete traceback are below:

import numpy as np
import pandas as pd
import arviz as az
import pymc3 as pm

Reading in the Sales data for 10 regions Data for 52 weeks (region ID, week number, sales, repvisits, and samples)

salesd = pd.read_csv(r"C:\Users\sreedatta\Downloads\pymc3_tests\sales10.csv")
salesd.head(10)

Confirming that the count of Regions is 10

n_regions = len(salesd['id'].drop_duplicates())
print(n_regions)

Defining the model (adapted from the Radon measurement example here with minimal changes: https://docs.pymc.io/notebooks/GLM-hierarchical.html)

with pm.Model() as hierarchical_model:
    # Hyperpriors for group nodes
    mu_a = pm.Normal("mu_a", mu=0.0, sigma=100)
    sigma_a = pm.HalfNormal("sigma_a", 5.0)
    mu_b = pm.Normal("mu_b", mu=0.0, sigma=100)
    sigma_b = pm.HalfNormal("sigma_b", 5.0)

    # Intercept for each region, distributed around group mean mu_a
    # Above we just set mu and sd to a fixed value while here we
    # plug in a common group distribution for all a and b (which are
    # vectors of length n_regions).
    a = pm.Normal("a", mu=mu_a, sigma=sigma_a, shape=n_regions)
    # Intercept for each region, distributed around group mean mu_a
    b = pm.Normal("b", mu=mu_b, sigma=sigma_b, shape=n_regions)

    # Model error
    eps = pm.HalfCauchy("eps", 5.0)

    sales_est = a[id] + b[id] * salesd.repvisits

    # Data likelihood
    sales_like = pm.Normal("sales_like", mu=sales_est, sigma=eps, observed=salesd.sales)

Results in the following error: TypeError: Unsupported dtype for TensorType: object

Full Traceback of the error: KeyError Traceback (most recent call last) C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\type.py in dtype_specs(self) 264 try: --> 265 return { 266 "float16": (float, "npy_float16", "NPY_FLOAT16"), KeyError: 'object' During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) C:\Users\SREEDATTA\AppData\Local\Temp/ipykernel_12844/3227314761.py in 17 eps = pm.HalfCauchy("eps", 5.0) 18 ---> 19 sales_est = a[id] + b[id] * salesd.repvisits.values 20 21 # Data likelihood C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\var.py in __getitem__(self, args) 513 # Convert python literals to theano constants 514 args = tuple( --> 515 [ 516 theano.tensor.subtensor.as_index_constant( 517 np.array(inp, dtype=np.int64) if is_empty_array(inp) else inp C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\var.py in (.0) 514 args = tuple( 515 [ --> 516 theano.tensor.subtensor.as_index_constant( 517 np.array(inp, dtype=np.int64) if is_empty_array(inp) else inp 518 ) C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\subtensor.py in as_index_constant(a) 58 return scal.ScalarConstant(scal.int64, a) 59 elif not isinstance(a, Variable): ---> 60 return theano.tensor.as_tensor(a) 61 else: 62 return a C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\basic.py in as_tensor_variable(x, name, ndim) 205 ) 206 --> 207 return constant(x, name=name, ndim=ndim) 208 209 C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\basic.py in constant(x, name, ndim, dtype) 253 assert x_.ndim == ndim 254 --> 255 ttype = TensorType(dtype=x_.dtype, broadcastable=[s == 1 for s in x_.shape]) 256 257 try: C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\type.py in __init__(self, dtype, broadcastable, name, sparse_grad) 52 # True or False 53 self.broadcastable = tuple(bool(b) for b in broadcastable) ---> 54 self.dtype_specs() # error checking is done there 55 self.name = name 56 self.numpy_dtype = np.dtype(self.dtype) C:\ProgramData\Anaconda3\envs\pm3py39\lib\site-packages\theano\tensor\type.py in dtype_specs(self) 280 }[self.dtype] 281 except KeyError: --> 282 raise TypeError( 283 f"Unsupported dtype for {self.__class__.__name__}: {self.dtype}" 284 ) TypeError: Unsupported dtype for TensorType: object
Output from Conda List in the Environment # Name Version Build Channel argon2-cffi 20.1.0 py39hb82d6ee_2 conda-forge arviz 0.11.2 pypi_0 pypi async_generator 1.10 py_0 conda-forge attrs 21.2.0 pyhd8ed1ab_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bambi 0.6.0 pypi_0 pypi blas 1.0 mkl conda-forge bleach 4.0.0 pyhd8ed1ab_0 conda-forge ca-certificates 2021.7.5 haa95532_1 cachetools 4.2.2 pypi_0 pypi cairo 1.16.0 hb19e0ff_1008 conda-forge cffi 1.14.6 py39h0878f49_0 conda-forge cftime 1.5.0 pypi_0 pypi colorama 0.4.4 pyh9f0ad1d_0 conda-forge cycler 0.10.0 pypi_0 pypi debugpy 1.4.1 py39h415ef7b_0 conda-forge decorator 5.0.9 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge dill 0.3.4 pypi_0 pypi entrypoints 0.3 pyhd8ed1ab_1003 conda-forge expat 2.4.1 h39d44d4_0 conda-forge fastprogress 1.0.0 pypi_0 pypi filelock 3.0.12 pypi_0 pypi font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.13.1 h1989441_1005 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge formulae 0.1.4 pypi_0 pypi freetype 2.10.4 h546665d_1 conda-forge fribidi 1.0.10 h8d14728_0 conda-forge getopt-win32 0.1 h8ffe710_0 conda-forge gettext 0.19.8.1 h1a89ca6_1005 conda-forge graphite2 1.3.13 1000 conda-forge graphviz 2.48.0 hefbd956_0 conda-forge gts 0.7.6 h7c369d9_2 conda-forge harfbuzz 2.9.0 hc601d6f_0 conda-forge icu 68.1 h0e60522_0 conda-forge importlib-metadata 4.6.4 py39hcbf5309_0 conda-forge intel-openmp 2021.3.0 h57928b3_3372 conda-forge ipykernel 6.2.0 py39h832f523_0 conda-forge ipython 7.26.0 py39h832f523_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jbig 2.1 h8d14728_2003 conda-forge jedi 0.18.0 py39hcbf5309_2 conda-forge jinja2 3.0.1 pyhd8ed1ab_0 conda-forge jpeg 9d h8ffe710_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py39hcbf5309_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge kiwisolver 1.3.1 pypi_0 pypi lerc 2.2.1 h0e60522_0 conda-forge libblas 3.9.0 1_h8933c1f_netlib conda-forge libcblas 3.9.0 5_hd5c7e75_netlib conda-forge libdeflate 1.7 h8ffe710_5 conda-forge libffi 3.3 h0e60522_2 conda-forge libgd 2.3.2 h138e682_0 conda-forge libglib 2.68.4 h1e62bf3_0 conda-forge libiconv 1.16 he774522_0 conda-forge liblapack 3.9.0 5_hd5c7e75_netlib conda-forge libpng 1.6.37 h1d00b33_2 conda-forge libpython 2.0 py39hcbf5309_1 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge libtiff 4.3.0 h0c97f57_1 conda-forge libwebp 1.2.1 h57928b3_0 conda-forge libwebp-base 1.2.1 h8ffe710_0 conda-forge libxcb 1.13 hcd874cb_1003 conda-forge libxml2 2.9.12 hf5bbc77_0 conda-forge llvmlite 0.36.0 py39ha0cd8c8_0 conda-forge lz4-c 1.9.3 h8ffe710_1 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge m2w64-openblas 0.2.19 1 msys2 markupsafe 2.0.1 py39hb82d6ee_0 conda-forge matplotlib 3.4.3 pypi_0 pypi matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge mistune 0.8.4 py39hb82d6ee_1004 conda-forge mkl 2021.3.0 haa95532_524 mkl-service 2.4.0 py39hb82d6ee_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge nbclient 0.5.4 pyhd8ed1ab_0 conda-forge nbconvert 6.1.0 py39hcbf5309_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge netcdf4 1.5.7 pypi_0 pypi notebook 6.4.3 pyha770c72_0 conda-forge numba 0.53.1 py39hb8cd55e_1 conda-forge numpy 1.21.2 py39h6635163_0 conda-forge openssl 1.1.1k h8ffe710_1 conda-forge packaging 21.0 pyhd8ed1ab_0 conda-forge pandas 1.3.2 pypi_0 pypi pandoc 2.14.1 h8ffe710_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge pango 1.48.9 hd84fcdd_0 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge patsy 0.5.1 pypi_0 pypi pcre 8.45 h0e60522_0 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.3.1 pypi_0 pypi pip 21.2.4 pyhd8ed1ab_0 conda-forge pixman 0.40.0 h8ffe710_0 conda-forge prometheus_client 0.11.0 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.19 pyha770c72_0 conda-forge pthread-stubs 0.4 hcd874cb_1001 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pygments 2.10.0 pyhd8ed1ab_0 conda-forge pymc3 3.11.3 pypi_0 pypi pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyrsistent 0.17.3 py39hb82d6ee_2 conda-forge python 3.9.6 h7840368_1_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-graphviz 0.17 pyhaef67bd_0 conda-forge python_abi 3.9 2_cp39 conda-forge pytz 2021.1 pypi_0 pypi pywin32 301 py39hb82d6ee_0 conda-forge pywinpty 1.1.3 py39h99910a6_0 conda-forge pyzmq 22.2.1 py39he46f08e_0 conda-forge scipy 1.7.1 py39hc0c34ad_0 conda-forge semver 2.13.0 pypi_0 pypi send2trash 1.8.0 pyhd8ed1ab_0 conda-forge setuptools 57.4.0 py39hcbf5309_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sqlite 3.36.0 h8ffe710_0 conda-forge statsmodels 0.12.2 pypi_0 pypi terminado 0.11.1 py39hcbf5309_0 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge theano-pymc 1.1.2 pypi_0 pypi tornado 6.1 py39hb82d6ee_1 conda-forge traitlets 5.0.5 py_0 conda-forge typing-extensions 3.10.0.0 pypi_0 pypi tzdata 2021a he74cb21_1 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge winpty 0.4.3 4 conda-forge xarray 0.19.0 pypi_0 pypi xorg-kbproto 1.0.7 hcd874cb_1002 conda-forge xorg-libice 1.0.10 hcd874cb_0 conda-forge xorg-libsm 1.2.3 hcd874cb_1000 conda-forge xorg-libx11 1.7.2 hcd874cb_0 conda-forge xorg-libxau 1.0.9 hcd874cb_0 conda-forge xorg-libxdmcp 1.1.3 hcd874cb_0 conda-forge xorg-libxext 1.3.4 hcd874cb_1 conda-forge xorg-libxpm 3.5.13 hcd874cb_0 conda-forge xorg-libxt 1.2.1 hcd874cb_2 conda-forge xorg-xextproto 7.3.0 hcd874cb_1002 conda-forge xorg-xproto 7.0.31 hcd874cb_1007 conda-forge xz 5.2.5 h62dcd97_1 conda-forge zeromq 4.3.4 h0e60522_0 conda-forge zipp 3.5.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h62dcd97_1010 conda-forge zstd 1.5.0 h6255e5f_0 conda-forge
sreedat commented 3 years ago

I also tested the exact same data set and model specifications with pymc3 V4 (using m2w64-toolchain with gcc 5.3.0 and I got a different type of error:

NotImplementedError: Cannot convert <built-in function id> to a tensor variable. (What is the id being referred to here?) There is a column in the data set labeled id for the Region ID. See the above post for more detailed description. If this is deemed a genuine problem then I will post it as a separate issue for pymc3 V4 / aeasara

The complete traceback of the error is below: NotImplementedError Traceback (most recent call last) C:\Users\SREEDATTA\AppData\Local\Temp/ipykernel_2976/406254412.py in 17 eps = pm.HalfCauchy("eps", 5.0) 18 ---> 19 sales_est = a[id] + b[id] * salesd.repvisits 20 21 # Data likelihood C:\ProgramData\Anaconda3\envs\pm3v4\lib\site-packages\aesara\tensor\var.py in __getitem__(self, args) 516 # Convert python literals to aesara constants 517 args = tuple( --> 518 [ 519 aet.subtensor.as_index_constant( 520 np.array(inp, dtype=np.int64) if is_empty_array(inp) else inp C:\ProgramData\Anaconda3\envs\pm3v4\lib\site-packages\aesara\tensor\var.py in (.0) 517 args = tuple( 518 [ --> 519 aet.subtensor.as_index_constant( 520 np.array(inp, dtype=np.int64) if is_empty_array(inp) else inp 521 ) C:\ProgramData\Anaconda3\envs\pm3v4\lib\site-packages\aesara\tensor\subtensor.py in as_index_constant(a) 127 return aes.ScalarConstant(aes.int64, a) 128 elif not isinstance(a, Variable): --> 129 return aesara.tensor.as_tensor(a) 130 else: 131 return a C:\ProgramData\Anaconda3\envs\pm3v4\lib\site-packages\aesara\tensor\__init__.py in as_tensor_variable(x, name, ndim, **kwargs) 39 40 """ ---> 41 return _as_tensor_variable(x, name, ndim, **kwargs) 42 43 C:\ProgramData\Anaconda3\envs\pm3v4\lib\functools.py in wrapper(*args, **kw) 875 '1 positional argument') 876 --> 877 return dispatch(args[0].__class__)(*args, **kw) 878 879 funcname = getattr(func, '__name__', 'singledispatch function') C:\ProgramData\Anaconda3\envs\pm3v4\lib\site-packages\aesara\tensor\__init__.py in _as_tensor_variable(x, name, ndim, **kwargs) 46 x, name: Optional[str], ndim: Optional[int], **kwargs 47 ) -> NoReturn: ---> 48 raise NotImplementedError(f"Cannot convert {x} to a tensor variable.") 49 50 NotImplementedError: Cannot convert to a tensor variable.
Conda List for Pymc3 V4 Environment # Name Version Build Channel aesara 2.2.0 py39h7fcc1c2_0 conda-forge argon2-cffi 20.1.0 py39hb82d6ee_2 conda-forge arviz 0.11.2 pypi_0 pypi async_generator 1.10 py_0 conda-forge attrs 21.2.0 pyhd8ed1ab_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge bleach 4.0.0 pyhd8ed1ab_0 conda-forge ca-certificates 2021.5.30 h5b45459_0 conda-forge cachetools 4.2.2 pypi_0 pypi cffi 1.14.6 py39h0878f49_0 conda-forge cftime 1.5.0 pypi_0 pypi cloudpickle 1.6.0 pypi_0 pypi colorama 0.4.4 pyh9f0ad1d_0 conda-forge cycler 0.10.0 pypi_0 pypi debugpy 1.4.1 py39h415ef7b_0 conda-forge decorator 5.0.9 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge fastprogress 1.0.0 pypi_0 pypi filelock 3.0.12 pyh9f0ad1d_0 conda-forge importlib-metadata 4.6.4 py39hcbf5309_0 conda-forge intel-openmp 2021.3.0 h57928b3_3372 conda-forge ipykernel 6.2.0 py39h832f523_0 conda-forge ipython 7.26.0 py39h832f523_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jedi 0.18.0 py39hcbf5309_2 conda-forge jinja2 3.0.1 pyhd8ed1ab_0 conda-forge jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge jupyter_core 4.7.1 py39hcbf5309_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge kiwisolver 1.3.1 pypi_0 pypi libblas 3.9.0 11_win64_mkl conda-forge libcblas 3.9.0 11_win64_mkl conda-forge libflang 5.0.0 h6538335_20180525 conda-forge libgpuarray 0.7.6 h8ffe710_1003 conda-forge liblapack 3.9.0 11_win64_mkl conda-forge libopenblas 0.3.17 pthreads_hc469a61_1 conda-forge libpython 2.0 py39hcbf5309_1 conda-forge libsodium 1.0.18 h8d14728_1 conda-forge llvm-meta 5.0.0 0 conda-forge llvmlite 0.36.0 py39ha0cd8c8_0 conda-forge m2w64-binutils 2.25.1 5 conda-forge m2w64-bzip2 1.0.6 6 conda-forge m2w64-crt-git 5.0.0.4636.2595836 2 conda-forge m2w64-gcc 5.3.0 6 conda-forge m2w64-gcc-ada 5.3.0 6 conda-forge m2w64-gcc-fortran 5.3.0 6 conda-forge m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gcc-objc 5.3.0 6 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-headers-git 5.0.0.4636.c0ad18a 2 conda-forge m2w64-isl 0.16.1 2 conda-forge m2w64-libiconv 1.14 6 conda-forge m2w64-libmangle-git 5.0.0.4509.2e5a9a2 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge m2w64-make 4.1.2351.a80a8b8 2 conda-forge m2w64-mpc 1.0.3 3 conda-forge m2w64-mpfr 3.1.4 4 conda-forge m2w64-openblas 0.2.19 1 msys2 m2w64-pkg-config 0.29.1 2 conda-forge m2w64-toolchain 5.3.0 7 conda-forge m2w64-toolchain_win-64 2.4.0 0 conda-forge m2w64-tools-git 5.0.0.4592.90b8472 2 conda-forge m2w64-windows-default-manifest 6.4 3 conda-forge m2w64-winpthreads-git 5.0.0.4634.697f757 2 conda-forge m2w64-zlib 1.2.8 10 conda-forge mako 1.1.5 pyhd8ed1ab_0 conda-forge markupsafe 2.0.1 py39hb82d6ee_0 conda-forge matplotlib 3.4.3 pypi_0 pypi matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge mistune 0.8.4 py39hb82d6ee_1004 conda-forge mkl 2021.3.0 hb70f87d_564 conda-forge mkl-service 2.4.0 py39hb82d6ee_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge nbclient 0.5.4 pyhd8ed1ab_0 conda-forge nbconvert 6.1.0 py39hcbf5309_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge netcdf4 1.5.7 pypi_0 pypi notebook 6.4.3 pyha770c72_0 conda-forge numba 0.53.0 py39h69f9ab1_0 conda-forge numpy 1.21.2 py39h6635163_0 conda-forge openblas 0.3.17 pthreads_h543f93c_1 conda-forge openmp 5.0.0 vc14_1 conda-forge openssl 1.1.1k h8ffe710_1 conda-forge packaging 21.0 pyhd8ed1ab_0 conda-forge pandas 1.3.2 pypi_0 pypi pandoc 2.14.1 h8ffe710_0 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.8.2 pyhd8ed1ab_0 conda-forge patsy 0.5.1 pypi_0 pypi pickleshare 0.7.5 py_1003 conda-forge pillow 8.3.1 pypi_0 pypi pip 21.2.4 pyhd8ed1ab_0 conda-forge prometheus_client 0.11.0 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.19 pyha770c72_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pygments 2.10.0 pyhd8ed1ab_0 conda-forge pygpu 0.7.6 py39h5d4886f_1002 conda-forge pymc3 4.0 pypi_0 pypi pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pyrsistent 0.17.3 py39hb82d6ee_2 conda-forge python 3.9.6 h7840368_1_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python_abi 3.9 2_cp39 conda-forge pytz 2021.1 pypi_0 pypi pywin32 301 py39hb82d6ee_0 conda-forge pywinpty 1.1.3 py39h99910a6_0 conda-forge pyzmq 22.2.1 py39he46f08e_0 conda-forge scipy 1.7.1 py39hc0c34ad_0 conda-forge send2trash 1.8.0 pyhd8ed1ab_0 conda-forge setuptools 57.4.0 py39hcbf5309_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sqlite 3.36.0 h8ffe710_0 conda-forge tbb 2021.3.0 h2d74725_0 conda-forge terminado 0.11.1 py39hcbf5309_0 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge tornado 6.1 py39hb82d6ee_1 conda-forge traitlets 5.0.5 py_0 conda-forge typing-extensions 3.10.0.0 pypi_0 pypi tzdata 2021a he74cb21_1 conda-forge ucrt 10.0.20348.0 h57928b3_0 conda-forge vc 14.2 hb210afc_5 conda-forge vs2015_runtime 14.29.30037 h902a5da_5 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.37.0 pyhd8ed1ab_1 conda-forge winpty 0.4.3 4 conda-forge xarray 0.19.0 pypi_0 pypi zeromq 4.3.4 h0e60522_0 conda-forge zipp 3.5.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h62dcd97_1010 conda-forge
michaelosthege commented 3 years ago

The line Cannot convert <built-in function id> to a tensor variable. refers to your code: You're trying to use id as a variable name, but id is a built-in function.

Typically overriding it should work, so I suspect you have a mixup somwhere upstream to the code example you posted.

The best practice would be to either use a different variable name alltogether, or use a suffix such as id_ to avoid conflicting with the built-in function.

sreedat commented 3 years ago

@michaelosthege sorry for the delay in following up. I had a case of break through covid that left me down and out. Changing the id to a different name ensured it ran correctly. Thanks again.