Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
f621144c
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f621144c
编写于
8月 22, 2019
作者:
X
xiaoting
提交者:
lvmengsi
8月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fetch_list type of gan (#795)
上级
fbdd8fdb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
12 deletion
+12
-12
02.recognize_digits/README.cn.md
02.recognize_digits/README.cn.md
+1
-1
02.recognize_digits/index.cn.html
02.recognize_digits/index.cn.html
+1
-1
09.gan/README.cn.md
09.gan/README.cn.md
+5
-5
09.gan/index.cn.html
09.gan/index.cn.html
+5
-5
未找到文件。
02.recognize_digits/README.cn.md
浏览文件 @
f621144c
...
@@ -399,7 +399,7 @@ prediction, [avg_loss, acc] = train_program()
...
@@ -399,7 +399,7 @@ prediction, [avg_loss, acc] = train_program()
# 输入的原始图像数据,名称为img,大小为28*28*1
# 输入的原始图像数据,名称为img,大小为28*28*1
# 标签层,名称为label,对应输入图片的类别标签
# 标签层,名称为label,对应输入图片的类别标签
# 告知网络传入的数据分为两部分,第一部分是img值,第二部分是label值
# 告知网络传入的数据分为两部分,第一部分是img值,第二部分是label值
feeder
=
fluid
.
DataFeeder
(
feed_list
=
[
‘
img
’
,
‘
label
’
],
place
=
place
)
feeder
=
fluid
.
DataFeeder
(
feed_list
=
[
'img'
,
'label'
],
place
=
place
)
# 选择Adam优化器
# 选择Adam优化器
optimizer
=
optimizer_program
()
optimizer
=
optimizer_program
()
...
...
02.recognize_digits/index.cn.html
浏览文件 @
f621144c
...
@@ -441,7 +441,7 @@ prediction, [avg_loss, acc] = train_program()
...
@@ -441,7 +441,7 @@ prediction, [avg_loss, acc] = train_program()
# 输入的原始图像数据,名称为img,大小为28*28*1
# 输入的原始图像数据,名称为img,大小为28*28*1
# 标签层,名称为label,对应输入图片的类别标签
# 标签层,名称为label,对应输入图片的类别标签
# 告知网络传入的数据分为两部分,第一部分是img值,第二部分是label值
# 告知网络传入的数据分为两部分,第一部分是img值,第二部分是label值
feeder = fluid.DataFeeder(feed_list=[
‘img’, ‘label’
], place=place)
feeder = fluid.DataFeeder(feed_list=[
'img', 'label'
], place=place)
# 选择Adam优化器
# 选择Adam优化器
optimizer = optimizer_program()
optimizer = optimizer_program()
...
...
09.gan/README.cn.md
浏览文件 @
f621144c
...
@@ -368,7 +368,7 @@ for pass_id in range(epoch):
...
@@ -368,7 +368,7 @@ for pass_id in range(epoch):
# 虚假图片
# 虚假图片
generated_image
=
exe
.
run
(
g_program
,
generated_image
=
exe
.
run
(
g_program
,
feed
=
{
'noise'
:
noise_data
},
feed
=
{
'noise'
:
noise_data
},
fetch_list
=
{
g_img
}
)[
0
]
fetch_list
=
[
g_img
]
)[
0
]
total_images
=
np
.
concatenate
([
real_image
,
generated_image
])
total_images
=
np
.
concatenate
([
real_image
,
generated_image
])
...
@@ -378,7 +378,7 @@ for pass_id in range(epoch):
...
@@ -378,7 +378,7 @@ for pass_id in range(epoch):
'img'
:
generated_image
,
'img'
:
generated_image
,
'label'
:
fake_labels
,
'label'
:
fake_labels
,
},
},
fetch_list
=
{
d_loss
}
)[
0
][
0
]
fetch_list
=
[
d_loss
]
)[
0
][
0
]
# D 判断真实图片为真的loss
# D 判断真实图片为真的loss
d_loss_2
=
exe
.
run
(
d_program
,
d_loss_2
=
exe
.
run
(
d_program
,
...
@@ -386,7 +386,7 @@ for pass_id in range(epoch):
...
@@ -386,7 +386,7 @@ for pass_id in range(epoch):
'img'
:
real_image
,
'img'
:
real_image
,
'label'
:
real_labels
,
'label'
:
real_labels
,
},
},
fetch_list
=
{
d_loss
}
)[
0
][
0
]
fetch_list
=
[
d_loss
]
)[
0
][
0
]
d_loss_n
=
d_loss_1
+
d_loss_2
d_loss_n
=
d_loss_1
+
d_loss_2
losses
[
0
].
append
(
d_loss_n
)
losses
[
0
].
append
(
d_loss_n
)
...
@@ -398,7 +398,7 @@ for pass_id in range(epoch):
...
@@ -398,7 +398,7 @@ for pass_id in range(epoch):
size
=
[
batch_size
,
NOISE_SIZE
]).
astype
(
'float32'
)
size
=
[
batch_size
,
NOISE_SIZE
]).
astype
(
'float32'
)
dg_loss_n
=
exe
.
run
(
dg_program
,
dg_loss_n
=
exe
.
run
(
dg_program
,
feed
=
{
'noise'
:
noise_data
},
feed
=
{
'noise'
:
noise_data
},
fetch_list
=
{
dg_loss
}
)[
0
][
0
]
fetch_list
=
[
dg_loss
]
)[
0
][
0
]
losses
[
1
].
append
(
dg_loss_n
)
losses
[
1
].
append
(
dg_loss_n
)
t_time
+=
(
time
.
time
()
-
s_time
)
t_time
+=
(
time
.
time
()
-
s_time
)
if
batch_id
%
10
==
0
:
if
batch_id
%
10
==
0
:
...
@@ -407,7 +407,7 @@ for pass_id in range(epoch):
...
@@ -407,7 +407,7 @@ for pass_id in range(epoch):
# 每轮的生成结果
# 每轮的生成结果
generated_images
=
exe
.
run
(
g_program_test
,
generated_images
=
exe
.
run
(
g_program_test
,
feed
=
{
'noise'
:
const_n
},
feed
=
{
'noise'
:
const_n
},
fetch_list
=
{
g_img
}
)[
0
]
fetch_list
=
[
g_img
]
)[
0
]
# 将真实图片和生成图片连接
# 将真实图片和生成图片连接
total_images
=
np
.
concatenate
([
real_image
,
generated_images
])
total_images
=
np
.
concatenate
([
real_image
,
generated_images
])
fig
=
plot
(
total_images
)
fig
=
plot
(
total_images
)
...
...
09.gan/index.cn.html
浏览文件 @
f621144c
...
@@ -410,7 +410,7 @@ for pass_id in range(epoch):
...
@@ -410,7 +410,7 @@ for pass_id in range(epoch):
# 虚假图片
# 虚假图片
generated_image = exe.run(g_program,
generated_image = exe.run(g_program,
feed={'noise': noise_data},
feed={'noise': noise_data},
fetch_list=
{g_img}
)[0]
fetch_list=
[g_img]
)[0]
total_images = np.concatenate([real_image, generated_image])
total_images = np.concatenate([real_image, generated_image])
...
@@ -420,7 +420,7 @@ for pass_id in range(epoch):
...
@@ -420,7 +420,7 @@ for pass_id in range(epoch):
'img': generated_image,
'img': generated_image,
'label': fake_labels,
'label': fake_labels,
},
},
fetch_list=
{d_loss}
)[0][0]
fetch_list=
[d_loss]
)[0][0]
# D 判断真实图片为真的loss
# D 判断真实图片为真的loss
d_loss_2 = exe.run(d_program,
d_loss_2 = exe.run(d_program,
...
@@ -428,7 +428,7 @@ for pass_id in range(epoch):
...
@@ -428,7 +428,7 @@ for pass_id in range(epoch):
'img': real_image,
'img': real_image,
'label': real_labels,
'label': real_labels,
},
},
fetch_list=
{d_loss}
)[0][0]
fetch_list=
[d_loss]
)[0][0]
d_loss_n = d_loss_1 + d_loss_2
d_loss_n = d_loss_1 + d_loss_2
losses[0].append(d_loss_n)
losses[0].append(d_loss_n)
...
@@ -440,7 +440,7 @@ for pass_id in range(epoch):
...
@@ -440,7 +440,7 @@ for pass_id in range(epoch):
size=[batch_size, NOISE_SIZE]).astype('float32')
size=[batch_size, NOISE_SIZE]).astype('float32')
dg_loss_n = exe.run(dg_program,
dg_loss_n = exe.run(dg_program,
feed={'noise': noise_data},
feed={'noise': noise_data},
fetch_list=
{dg_loss}
)[0][0]
fetch_list=
[dg_loss]
)[0][0]
losses[1].append(dg_loss_n)
losses[1].append(dg_loss_n)
t_time += (time.time() - s_time)
t_time += (time.time() - s_time)
if batch_id % 10 == 0 :
if batch_id % 10 == 0 :
...
@@ -449,7 +449,7 @@ for pass_id in range(epoch):
...
@@ -449,7 +449,7 @@ for pass_id in range(epoch):
# 每轮的生成结果
# 每轮的生成结果
generated_images = exe.run(g_program_test,
generated_images = exe.run(g_program_test,
feed={'noise': const_n},
feed={'noise': const_n},
fetch_list=
{g_img}
)[0]
fetch_list=
[g_img]
)[0]
# 将真实图片和生成图片连接
# 将真实图片和生成图片连接
total_images = np.concatenate([real_image, generated_images])
total_images = np.concatenate([real_image, generated_images])
fig = plot(total_images)
fig = plot(total_images)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录