Skip to content

Commit

Permalink
add relu in layer_math.py
Browse files Browse the repository at this point in the history
  • Loading branch information
luotao1 committed Mar 6, 2017
1 parent ca62c10 commit 8243797
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions python/paddle/trainer_config_helpers/layer_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def op(input, name=None):
register_unary_math_op('sigmoid', act.SigmoidActivation())
register_unary_math_op('tanh', act.TanhActivation())
register_unary_math_op('square', act.SquareActivation())
register_unary_math_op('relu', act.ReluActivation())


def add(layeroutput, other):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
x = layer_math.log(x)
x = layer_math.abs(x)
x = layer_math.sigmoid(x)
x = layer_math.tanh(x)
x = layer_math.square(x)
x = layer_math.square(x)
x = layer_math.relu(x)
y = 1 + x
y = y + 1
y = x + y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,28 @@ layers {
}
}
}
layers {
name: "__tanh_0__"
type: "mixed"
size: 100
active_type: "tanh"
inputs {
input_layer_name: "__sigmoid_0__"
proj_conf {
type: "identity"
name: "___tanh_0__.w0"
input_size: 100
output_size: 100
}
}
}
layers {
name: "__square_0__"
type: "mixed"
size: 100
active_type: "square"
inputs {
input_layer_name: "__sigmoid_0__"
input_layer_name: "__tanh_0__"
proj_conf {
type: "identity"
name: "___square_0__.w0"
Expand All @@ -81,15 +96,15 @@ layers {
}
}
layers {
name: "__square_1__"
name: "__relu_0__"
type: "mixed"
size: 100
active_type: "square"
active_type: "relu"
inputs {
input_layer_name: "__square_0__"
proj_conf {
type: "identity"
name: "___square_1__.w0"
name: "___relu_0__.w0"
input_size: 100
output_size: 100
}
Expand All @@ -101,7 +116,7 @@ layers {
size: 100
active_type: ""
inputs {
input_layer_name: "__square_1__"
input_layer_name: "__relu_0__"
}
slope: 1.0
intercept: 1
Expand All @@ -123,7 +138,7 @@ layers {
size: 100
active_type: ""
inputs {
input_layer_name: "__square_1__"
input_layer_name: "__relu_0__"
proj_conf {
type: "identity"
name: "___mixed_0__.w0"
Expand All @@ -147,7 +162,7 @@ layers {
size: 100
active_type: ""
inputs {
input_layer_name: "__square_1__"
input_layer_name: "__relu_0__"
}
slope: -1.0
intercept: 0.0
Expand Down Expand Up @@ -339,8 +354,9 @@ sub_models {
layer_names: "__log_0__"
layer_names: "__abs_0__"
layer_names: "__sigmoid_0__"
layer_names: "__tanh_0__"
layer_names: "__square_0__"
layer_names: "__square_1__"
layer_names: "__relu_0__"
layer_names: "__slope_intercept_layer_0__"
layer_names: "__slope_intercept_layer_1__"
layer_names: "__mixed_0__"
Expand Down

0 comments on commit 8243797

Please sign in to comment.