Skip to content

Commit c9ec2f8

Browse files
committed
math_ consistent code style
#39
1 parent 2c1ba07 commit c9ec2f8

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

nn/math_.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,54 @@
44
"""
55

66
from .. import nn
7-
from .base import LayerRef, Layer
87

98

10-
def relu(x: LayerRef) -> Layer:
9+
def relu(x: nn.LayerRef) -> nn.Layer:
1110
"""ReLU"""
1211
return _activation(x, activation="relu")
1312

1413

15-
def elu(x: LayerRef) -> Layer:
14+
def elu(x: nn.LayerRef) -> nn.Layer:
1615
"""ELU https://arxiv.org/abs/1511.07289"""
1716
return _activation(x, activation="elu")
1817

1918

20-
def selu(x: LayerRef) -> Layer:
19+
def selu(x: nn.LayerRef) -> nn.Layer:
2120
"""SELU https://arxiv.org/abs/1706.02515"""
2221
return _activation(x, activation="selu")
2322

2423

25-
def gelu(x: LayerRef) -> Layer:
24+
def gelu(x: nn.LayerRef) -> nn.Layer:
2625
"""GELU https://arxiv.org/abs/1606.08415"""
2726
return _activation(x, activation="gelu")
2827

2928

30-
def exp(x: LayerRef) -> Layer:
29+
def exp(x: nn.LayerRef) -> nn.Layer:
3130
"""exp"""
3231
return _activation(x, activation="exp")
3332

3433

35-
def log(x: LayerRef) -> Layer:
34+
def log(x: nn.LayerRef) -> nn.Layer:
3635
"""log"""
3736
return _activation(x, activation="log")
3837

3938

40-
def tanh(x: LayerRef) -> Layer:
39+
def tanh(x: nn.LayerRef) -> nn.Layer:
4140
"""tanh"""
4241
return _activation(x, activation="tanh")
4342

4443

45-
def sigmoid(x: LayerRef) -> Layer:
44+
def sigmoid(x: nn.LayerRef) -> nn.Layer:
4645
"""sigmoid"""
4746
return _activation(x, activation="sigmoid")
4847

4948

50-
def log_sigmoid(x: LayerRef) -> Layer:
49+
def log_sigmoid(x: nn.LayerRef) -> nn.Layer:
5150
"""log sigmoid"""
5251
return _activation(x, activation="log_sigmoid")
5352

5453

55-
def swish(x: LayerRef) -> Layer:
54+
def swish(x: nn.LayerRef) -> nn.Layer:
5655
"""swish"""
5756
return _activation(x, activation="swish")
5857

@@ -61,14 +60,14 @@ def swish(x: LayerRef) -> Layer:
6160
softmax = nn.softmax
6261

6362

64-
def log_softmax(x: LayerRef, **kwargs) -> Layer:
63+
def log_softmax(x: nn.LayerRef, **kwargs) -> nn.Layer:
6564
"""
6665
Wraps :func:`nn.softmax` with log_space=True.
6766
"""
6867
return nn.softmax(x, log_space=True, **kwargs)
6968

7069

71-
def _activation(x: LayerRef, activation: str) -> Layer:
70+
def _activation(x: nn.LayerRef, activation: str) -> nn.Layer:
7271
"""
7372
RETURNN ActivationLayer.
7473
Only for internal use.

0 commit comments

Comments
 (0)