From 0480aa48d93a4a9a2fe742f9dea82cdf8b771da2 Mon Sep 17 00:00:00 2001 From: ceci3 Date: Fri, 15 May 2020 17:25:30 +0800 Subject: [PATCH] Update gan to 1.8 (#4625) * fix init * update * update_1.8 * update paddle.reader * update data --- PaddleCV/gan/c_gan/c_gan.py | 16 ++++++++-------- PaddleCV/gan/c_gan/dc_gan.py | 8 ++++---- PaddleCV/gan/network/base_network.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/PaddleCV/gan/c_gan/c_gan.py b/PaddleCV/gan/c_gan/c_gan.py index 53a79e3b..4ab1d59a 100644 --- a/PaddleCV/gan/c_gan/c_gan.py +++ b/PaddleCV/gan/c_gan/c_gan.py @@ -61,18 +61,18 @@ def train(args): dg_program = fluid.Program() with fluid.program_guard(d_program): - conditions = fluid.layers.data( - name='conditions', shape=[1], dtype='float32') - img = fluid.layers.data(name='img', shape=[784], dtype='float32') - label = fluid.layers.data(name='label', shape=[1], dtype='float32') + conditions = fluid.data( + name='conditions', shape=[None, 1], dtype='float32') + img = fluid.data(name='img', shape=[None, 784], dtype='float32') + label = fluid.data(name='label', shape=[None, 1], dtype='float32') d_logit = D_cond(img, conditions) d_loss = loss(d_logit, label) with fluid.program_guard(dg_program): - conditions = fluid.layers.data( - name='conditions', shape=[1], dtype='float32') - noise = fluid.layers.data( - name='noise', shape=[NOISE_SIZE], dtype='float32') + conditions = fluid.data( + name='conditions', shape=[None, 1], dtype='float32') + noise = fluid.data( + name='noise', shape=[None, NOISE_SIZE], dtype='float32') g_img = G_cond(z=noise, y=conditions) g_program = dg_program.clone() diff --git a/PaddleCV/gan/c_gan/dc_gan.py b/PaddleCV/gan/c_gan/dc_gan.py index 9ad42d4f..11520d48 100644 --- a/PaddleCV/gan/c_gan/dc_gan.py +++ b/PaddleCV/gan/c_gan/dc_gan.py @@ -60,14 +60,14 @@ def train(args): dg_program = fluid.Program() with fluid.program_guard(d_program): - img = fluid.layers.data(name='img', shape=[784], dtype='float32') - label = fluid.layers.data(name='label', shape=[1], dtype='float32') + img = fluid.data(name='img', shape=[None, 784], dtype='float32') + label = fluid.data(name='label', shape=[None, 1], dtype='float32') d_logit = D(img) d_loss = loss(d_logit, label) with fluid.program_guard(dg_program): - noise = fluid.layers.data( - name='noise', shape=[NOISE_SIZE], dtype='float32') + noise = fluid.data( + name='noise', shape=[None, NOISE_SIZE], dtype='float32') g_img = G(x=noise) g_program = dg_program.clone() diff --git a/PaddleCV/gan/network/base_network.py b/PaddleCV/gan/network/base_network.py index 2aba0eb7..f856401e 100644 --- a/PaddleCV/gan/network/base_network.py +++ b/PaddleCV/gan/network/base_network.py @@ -508,9 +508,9 @@ def conv2d_with_filter(input, groups mismatch. Examples: .. code-block:: python - data = fluid.layers.data(name='data', shape=[3, 32, 32], \ + data = fluid.data(name='data', shape=[None, 3, 32, 32], \ dtype='float32') - filter = fluid.layers.data(name='filter',shape=[10,3,3,3], \ + filter = fluid.data(name='filter',shape=[None, 10, 3, 3, 3], \ dtype='float32',append_batch_size=False) conv2d = fluid.layers.conv2d(input=data, filter=filter, -- GitLab