diff --git a/PaddleCV/gan/c_gan/c_gan.py b/PaddleCV/gan/c_gan/c_gan.py index 53a79e3b2d05991bc44a88272ecbd5c3a2b20c43..4ab1d59a9b48656716eb635af5552da6b4661225 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 9ad42d4fe0b0a49c23af0d658962e2dadaa30aab..11520d48f2cd0b945e74bce61061724315d5647f 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 2aba0eb737190c5f968ad429da3a58442a0106aa..f856401e5594f45b69e4b85054ab27dd8d85cc83 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,