Overview
Implementation
function relu(){
return {
type:'relu',
evaluate:function(input){
let result = [];
for(let row of input){
let val = row[0];
if(val >0) result.push([val]);
else result.push([0]);
}
return result;
},
inputGradient:function(input){
let result = [];
for(let row of input){
let val = row[0];
if(val >0) result.push([1]);
else result.push([0]);
}
return result;
},
};
}