         // We need our grid size to be exactly the maximum width of the output
         threads = dim3(max_width);
 
-        shared_mem_size = (max_width + total_neurons) * sizeof(float);
+        shared_mem_size = max_width * sizeof(float);
     }
 };
 


    /* Where we accumulate our errors, layer by layer.  The size is that of
       the largest dimension. */
    extern __shared__ float errors[];

    /* The layer outputs (activation of the neurons).  This is where the
       shared memory goes to.  Note that we store only the activated outputs,

                    l);
            for (unsigned i = 0;  i < ni;  ++i) {
                fprintf(stderr, "input %d: error %f\n",
                        i, scratch[i]);
            }
        }
#endif
