fix bugs in InstanceOfRepeatNeuralNetwork, and pass gradient check