math_ops.py 1.1 KB
Newer Older
D
dzhwinter 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
#  Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
14 15
from paddle.trainer_config_helpers import *

Q
qijun 已提交
16
settings(batch_size=1000, learning_rate=1e-5)
17 18

x = data_layer(name='data', size=100)
19
x = layer_math.exp(x)
X
xuwei06 已提交
20 21
x = layer_math.sqrt(x)
x = layer_math.reciprocal(x)
22 23 24
x = layer_math.log(x)
x = layer_math.abs(x)
x = layer_math.sigmoid(x)
L
Luo Tao 已提交
25
x = layer_math.tanh(x)
26
x = layer_math.square(x)
L
Luo Tao 已提交
27
x = layer_math.relu(x)
28 29 30 31 32 33
y = 1 + x
y = y + 1
y = x + y
y = y - x
y = y - 2
y = 2 - y
X
xuwei06 已提交
34 35
y = 2 * y
y = y * 3
Q
qijun 已提交
36
z = data_layer(name='data_2', size=1)
X
xuwei06 已提交
37 38 39 40
y = y * z
y = z * y
y = y + z
y = z + y
41
outputs(y)