title: Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'
body: <p>I am trying to run the following model, but it fails during compilation:</p>
  
  <pre><code>import numpy as np
  import pymc3 as pm
  
  
  def sample_data(G=1, K=2):
      # mean proportion ([0,1]) for each g
      p_g = np.random.beta(2, 2, size=G)
  
      # concentration around each p_g
      c_g = np.random.lognormal(mean=0.5, sigma=1, size=G)
  
      # reparameterization for standard Beta(a,b)
      a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2)
      b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2)
  
      # for each p_g, sample K proportions
      p_gk = np.random.beta(a_g[:, np.newaxis], b_g[:, np.newaxis], size=(G, K))
  
      return p_gk
  
  # Data size
  G = 3
  K = 5
  
  # obtain a G x K array of proportions p_gk in [0,1]
  data = sample_data(G, K) 
  
  with pm.Model() as m:
  
      # Parameters
      p_g = pm.Beta('p_g', 1., 1., shape=G)
      sd_g = pm.HalfNormal('sd_g', sd=1., shape=G)
  
      # Observed proportions
      p_gk = pm.Beta('p_gk', mu=p_g, sd=sd_g, shape=(G, K), observed=data)
  
      trace = pm.sample(2000)
  </code></pre>
  
  <p>with these errors:</p>
  
  <pre><code>Exception: ("Compilation failed (return status=1):
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:400: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] = {V3_n0, V3_n1};.
                             ^~~~~.
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:400:27:
    note: insert an explicit cast to silence this issue.
       int init_totals[2] = {V3_n0, V3_n1};.
                             ^~~~~.
                             static_cast&lt;int&gt;( ).
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:400: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] = {V3_n0, V3_n1};.
                                    ^~~~~.
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:400:34: 
    note: insert an explicit cast to silence this issue.
       int init_totals[2] = {V3_n0, V3_n1};.
                                    ^~~~~.
                                    static_cast&lt;int&gt;( ).
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:412:9: 
    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/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:412:9: 
    note: insert an explicit cast to silence this issue.
           V3_stride0, V3_stride1, .
           ^~~~~~~~~~.
           static_cast&lt;int&gt;( ).
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:412:21: 
    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/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:412:21:
    note: insert an explicit cast to silence this issue.
           V3_stride0, V3_stride1, .
                       ^~~~~~~~~~.
                       static_cast&lt;int&gt;( ).
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:413: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/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:413:1: 
    note: insert an explicit cast to silence this issue.
   V1_stride0, V1_stride1.
   ^~~~~~~~~~.
   static_cast&lt;int&gt;( ).
  
  /Users/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:413: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/mfansler/.theano/compiledir_Darwin-17.6.0-x86_64-i386-64bit-i386-3.6.3-64/tmpr58gulp2/mod.cpp:413:13:
    note: insert an explicit cast to silence this issue.
   V1_stride0, V1_stride1.
               ^~~~~~~~~~.
               static_cast&lt;int&gt;( ).
  
  6 errors generated.. ", '[Elemwise{log,no_inplace}(TensorConstant{[[0.297343..76841722]]})]')
  </code></pre>
  
  <p>I'm new to PyMC3. I don't see these errors when running existing PyMC3 examples. I suspect that I'm seeing these because I'm using a multidimensional format (i.e., <code>(G,K)</code>), since I haven't seen others using this format (I might be imposing my familiarity with Stan).</p>
  
  <p>Generally, I'm having trouble getting a sense of how to implement multilevel models that have multiple dimensions.</p>
  
  <p>Any idea what is causing the errors I'm seeing?</p>
  
  <hr>
  
  <h2>Versions</h2>
  
  <ul>
  <li>python 3.6.3</li>
  <li>numpy 1.14.5</li>
  <li>Theano 1.0.2</li>
  <li>pymc3 3.4.1</li>
  <li>Mac OS 10.13.5</li>
  </ul>
  
  <hr>
  
  <h1>Update</h1>
  
  <p>I installed the same package versions (via <code>conda</code>) on an HPC node (CentOS 7), and was able to run <a href="https://stackoverflow.com/a/51291640/570918">the modified version of the model suggested by @colcarroll</a>.  However, on my OS X machine, I still see the Theano compilation errors indicated above, even with the model changes. Is this possibly a <code>clang</code> problem? Can one specify the compiler for Theano to use?</p>