Because the starting matrices are randomly generated, the actual results of some tests may oscillate. Either improve the strength of the signal in the test input or increase the number of steps in the gradient descent to make sure they always converge.