I have a javascript matrix class with constructor
class Matrix {
constructor(rows, cols) {
this.rows = rows;
this.cols = cols;
this.data = Array(this.rows).fill().map(() => Array(this.cols).fill(0));
}
Now I have a matrix namely weights_1
which the size is 32 * 64
How to randomly selects some elements in weights_1
and make them to zero? for example, I want to make 30% of elements in the weights_1
to zero.