Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"fix api" #5

Merged
merged 1 commit into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions paddle/test_recognize_digits_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from paddle.v2.fluid.executor import Executor
from paddle.v2.fluid.optimizer import AdamOptimizer
from paddle.v2.fluid.initializer import NormalInitializer
from paddle.v2.fluid.param_attr import ParamAttr
import numpy as np
import time

Expand Down Expand Up @@ -42,8 +43,8 @@
predict = layers.fc(input=conv_pool_2,
size=SIZE,
act="softmax",
param_initializer=NormalInitializer(
loc=0.0, scale=scale, seed=SEED))
param_attr=ParamAttr(initializer=NormalInitializer(
loc=0.0, scale=scale, seed=SEED)))

cost = layers.cross_entropy(input=predict, label=label)
avg_cost = layers.mean(x=cost)
Expand Down
4 changes: 3 additions & 1 deletion tensorflow/refactor_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def paddle_random_normal(shape, loc=.0, scale=1., seed=1, dtype="float32"):
optimizer = tf.train.AdamOptimizer(learning_rate=0.001, beta1=0.9, beta2=0.999)
train_op = optimizer.minimize(avg_cost)

with tf.Session() as sess:
config = tf.ConfigProto(
intra_op_parallelism_threads=1, inter_op_parallelism_threads=1)
with tf.Session(config=config) as sess:
init_g = tf.global_variables_initializer()
init_l = tf.local_variables_initializer()
sess.run(init_g)
Expand Down