 }
 
 void Sigmoid::feedForward(mat& fout, const mat& fin) {
-  fout = ext::sigmoid(const_cast<mat&>(fin) * _w);
+  fout = ext::sigmoid(fin * _w);
   fillLastColumnWith(fout, (float) 1.0);
 }
 

      error.getData(), error.getRows());

  gemm(fin, delta, _w, -learning_rate, 1.0f, true, false);
  // _dw = ~const_cast<mat&>(fin) * delta;
}

void Softmax::backPropagate(mat& error, const mat& fin, const mat& fout, float learning_rate) {

  mat error_times_fout = error & fout;
  mat delta = error_times_fout - (rowSum(error_times_fout) & fout);

  // Ignore last column, which is the bias
  size_t traceLength = delta.getCols() - 1;
