From d8d384b8c628ec7ea1e187485e77317ab5bfad06 Mon Sep 17 00:00:00 2001 From: inter Date: Thu, 4 Sep 2025 14:09:16 +0800 Subject: [PATCH] Add File --- .../java/org/dromara/easyai/function/ELu.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/org/dromara/easyai/function/ELu.java diff --git a/src/main/java/org/dromara/easyai/function/ELu.java b/src/main/java/org/dromara/easyai/function/ELu.java new file mode 100644 index 0000000..42f2d5b --- /dev/null +++ b/src/main/java/org/dromara/easyai/function/ELu.java @@ -0,0 +1,36 @@ +package org.dromara.easyai.function; + + +import org.dromara.easyai.i.ActiveFunction; + +/** + * @param + * @DATA + * @Author LiDaPeng + * @Description + */ +public class ELu implements ActiveFunction { + private final float a; + + public ELu(float a) { + this.a = a; + } + + @Override + public float function(float x) { + if (x > 0) { + return x; + } else { + return (float) (a * ((float)Math.exp(x) - 1)); + } + } + + @Override + public float functionG(float out) { + if (out > 0) { + return 1; + } else { + return out + a; + } + } +}