Add File
This commit is contained in:
28
src/main/java/org/dromara/easyai/function/ReLu.java
Normal file
28
src/main/java/org/dromara/easyai/function/ReLu.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.dromara.easyai.function;
|
||||
|
||||
import org.dromara.easyai.i.ActiveFunction;
|
||||
|
||||
/**
|
||||
* @author lidapeng
|
||||
* @description ReLu 函数
|
||||
* @date 8:56 上午 2020/1/11
|
||||
*/
|
||||
public class ReLu implements ActiveFunction {
|
||||
@Override
|
||||
public float function(float x) {
|
||||
if (x > 0) {
|
||||
return x;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float functionG(float out) {
|
||||
if (out > 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user