relu method

Value relu()

Implementation

Value relu() {
  final out = Value(data < 0 ? 0.0 : data, {this}, 'ReLU');
  out._backward = () {
    this.grad += (out.data > 0 ? 1.0 : 0.0) * out.grad;
  };
  return out;
}