Skip to content

Commit 796543c

Browse files
committed
fix tf prelu
1 parent 69e3a29 commit 796543c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tensorlayerx/backend/ops/tensorflow_nn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,12 +2765,12 @@ def __init__(self, data_format):
27652765
def __call__(self, input, weight):
27662766

27672767
pos = tf.nn.relu(input)
2768-
neg = -weight * tf.nn.relu(input)
2768+
neg = -tf.nn.sigmoid(weight) * tf.nn.relu(-input)
27692769
return pos + neg
27702770

27712771

27722772
def prelu(input, weight, data_format):
27732773

27742774
pos = tf.nn.relu(input)
2775-
neg = -weight * tf.nn.relu(input)
2775+
neg = -tf.nn.sigmoid(weight) * tf.nn.relu(-input)
27762776
return pos + neg

0 commit comments

Comments
 (0)