Nervana Neon AttributeError: 'NoneType' object has no attribute 'sizeI'
<p>I'm a trying to do fprop with Nervana Neon, however, when I go to run model fprop I get the following error:</p>

<blockquote>
  <p>AttributeError: 'NoneType' object has no attribute 'sizeI'</p>
</blockquote>

<p>I am following their example for fprop very close. I've trained the model using their <code>ImageLoader</code> and now I want to utilize the results in a system. I've tried using <code>model.get_outputs(ArrayIterator(myData))</code> but still issues. Any thoughts?</p>

<pre><code>xdev = np.zeros((3 * 224 * 224, batch_size), dtype=np.float32)
xbuf = np.zeros((3 * 224 * 224, batch_size), dtype=np.float32)
img = to_neon(new_img) # function to flatten image to (3 * 224 * 224, ) 
xbuf[:,0] = img[:, 0]
model = model.load_params("/path/to/params.p")
out = model.fprop(xdev)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
&lt;ipython-input-35-fc650f5dcbc4&gt; in &lt;module&gt;()
----&gt; 1 out = model.fprop(xdev)

/root/neon/neon/models/model.pyc in fprop(self, x, inference)
    213             Tensor: the output of the final layer in the model
    214         """
--&gt; 215         return self.layers.fprop(x, inference)
    216 
    217     def bprop(self, delta):

/root/neon/neon/layers/container.pyc in fprop(self, inputs, inference, beta)
    248                 x = l.fprop(x, inference, beta=beta)
    249             else:
--&gt; 250                 x = l.fprop(x, inference)
    251 
    252         if inference:

/root/neon/neon/layers/layer.pyc in fprop(self, inputs, inference, beta)
    787         self.inputs = inputs
    788         self.be.fprop_conv(self.nglayer, inputs, self.W, self.outputs, beta=beta,
--&gt; 789                            bsum=self.batch_sum)
    790         return self.outputs
    791 

/root/neon/neon/backends/nervanagpu.pyc in fprop_conv(self, layer, I, F, O, X, bias, bsum, alpha, beta, relu, brelu, slope, repeat)
   1936         repeat: used in benchmarking
   1937         """
-&gt; 1938         assert layer.sizeI == I.size
   1939         assert layer.sizeF == F.size
   1940         assert layer.sizeO == O.size

AttributeError: 'NoneType' object has no attribute 'sizeI'
</code></pre>

<p>Working backwards on your stacktrace...</p>

<p>The problem comes from an attempt to dereference the <code>sizeI</code> attribute of a <code>layer</code> object when <code>layer</code> is <code>None</code>:</p>

<p><code>-&gt; 1938         assert layer.sizeI == I.size</code></p>

<p>I'd call that a bug in the neon library (<code>backends/nervanagpu.py</code>)- it should have above that 1938 line something like:</p>

<pre><code>    assert isinstance(layer, TheExpectedLayerClass)
</code></pre>

<p>A similar check could have been added even earlier, in <code>layers/layer.py</code>, before line 788:</p>

<pre><code>    assert isinstance(self.nglayer, TheExpectedLayerClass)
</code></pre>

<p>But often hitting such bugs in 3rd party libs are simply indications that the library is not used in the way it was intended to. The bugs simply <em>obscure</em> the real cause by not making the proper checks earlier, where maybe it's clear what's missing. </p>

<p>So check the docs/tutorials, maybe you're missing some init/setup step, some additional argument somewhere, etc. Or, if you're more familiar with neon, keep going backwards on the stacktrace until you find what's missing.</p>

python deep-learning