relu method
Implementation
Node relu() {
final out = Node(value > 0 ? value : 0, 'ReLU');
out._parents = [this];
out._backward.add(() {
this.grad += (out.value > 0 ? 1.0 : 0.0) * out.grad;
});
return out;
}
Node relu() {
final out = Node(value > 0 ? value : 0, 'ReLU');
out._parents = [this];
out._backward.add(() {
this.grad += (out.value > 0 ? 1.0 : 0.0) * out.grad;
});
return out;
}