relu method

List<double> relu(
  1. List<double> val
)

Rectified Linear unit activation function:

f(x) = max(0, x)

Implementation

List<double> relu(List<double> val) {
  val.asMap().forEach((i, v) => val[i] = max(0, val[i]));
  return val;
}