public override LMatrix backward(LMatrix dout) { LMatrix _out = dout.Copy(); for (int row = 0; row < _out.Row; row++) { for (int col = 0; col < _out.Column; col++) { if (mask.Matrix[row, col] <= 0) { _out.Matrix[row, col] = 0; } } } return(_out); }
public override LMatrix forward(LMatrix xMatrix, bool train_flg = true) { mask = xMatrix < 0;//如果是负值就设值为0 ,如果是正值设置为原来的值 //xMatrix.ChangeValue(mask);//改变原来的值,小于0 的值设置为0 LMatrix _out = xMatrix.Copy(); for (int row = 0; row < _out.Row; row++) { for (int col = 0; col < _out.Column; col++) { if (_out.Matrix[row, col] <= 0) { _out.Matrix[row, col] = 0; } } } return(_out); }