I have a for
loop that looks like this in Python:
def layerOneBackprop(l, a):
for x in range(len(l.weights)):
for y in range(len(l.weights[x])):
l.weightDelta[x][y] = a.weightDelta[0][x] * a.weights[0][x] * dSigmoid(l.layerOut[x])
dW = l.inVals[y] * l.weightDelta[x][y]
l.weights[x][y] = l.weights[x][y] - (learningRate * dW)
My current problem is that this loop (the entire function actually) is quite slow as it takes nearly 30-40 seconds to run per call. I am hoping that parallelizing this function will help it run faster on my server. How would this be done in Python?
I have seen thread implementations but I have also read that the GIL for Python may cause my code to become essentially single threaded. How could this be accomplished without such problems?