a = x[:, 1:, 1:].swapaxes(0, 1)
x = W[:, :, (0), (0)].dot(a) + W[:, :, (0), (1)].dot(b) + W[:, :, (1), (0)
    ].dot(c) + W[:, :, (1), (1)].dot(d) + biases.reshape(-1, 1, 1)
Increasing speed of a pure Numpy/Scipy convolutional neural network implementation