Øystein Schønning-Johansen
2016-05-05 09:38:51 UTC
Hi!
I've written a little code of numpy code that does a neural network
feedforward calculation:
def feedforward(self,x):
for activation, w, b in zip( self.activations, self.weights,
self.biases ):
x = activation( np.dot(w, x) + b)
This works fine when my activation functions are in Python, however I've
wrapped the activation functions from a C implementation that requires the
array to be memory aligned. (due to simd instructions in the C
implementation.) So I need the operation np.dot( w, x) + b to return a
ndarray where the data pointer is aligned. How can I do that? Is it
possible at all?
(BTW: the function works correctly about 20% of the time I run it, and
else it segfaults on the simd instruction in the the C function)
Thanks,
-Ãystein
I've written a little code of numpy code that does a neural network
feedforward calculation:
def feedforward(self,x):
for activation, w, b in zip( self.activations, self.weights,
self.biases ):
x = activation( np.dot(w, x) + b)
This works fine when my activation functions are in Python, however I've
wrapped the activation functions from a C implementation that requires the
array to be memory aligned. (due to simd instructions in the C
implementation.) So I need the operation np.dot( w, x) + b to return a
ndarray where the data pointer is aligned. How can I do that? Is it
possible at all?
(BTW: the function works correctly about 20% of the time I run it, and
else it segfaults on the simd instruction in the the C function)
Thanks,
-Ãystein