I am trying to add random values to a specific amount of values in a numpy array to mutate weights of my neural network. For example, 2 of the values in this array
[ [0 1 2]
[3 4 5]
[6 7 8] ]
are supposed to be mutated (i. e. a random value between -1 and 1 is added to them). The result may look something like this then:
[ [0 0.7 2]
[3 4 5]
[6.9 7 8]]
I would prefer a solution without looping, as my real problem is a little bigger than a 3x3 matrix and looping usually is inefficient.