diff --git a/python/paddle/fluid/dygraph/parallel.py b/python/paddle/fluid/dygraph/parallel.py index 472022bced7e3e2dd11d301501ebaec75e5e412a..531b4eb5d5294c54c10031dcc98e4a9bacfc5766 100644 --- a/python/paddle/fluid/dygraph/parallel.py +++ b/python/paddle/fluid/dygraph/parallel.py @@ -416,7 +416,7 @@ class DataParallel(layers.Layer): g_var_shapes.append(g_var.shape) flattened_vars.append( nn.reshape( - x=g_var, shape=[np.prod(g_var.shape)], inplace=True)) + x=g_var, shape=[np.prod(g_var.shape)])) coalesced_grad = nn.concat(flattened_vars) coalesced_grads_and_grad_vars.append( [coalesced_grad, grad_vars, g_var_shapes]) diff --git a/python/paddle/fluid/layers/loss.py b/python/paddle/fluid/layers/loss.py index f468815c99ea2751913c5535c721ee9a6a5c5052..50fed1c667a70f60e7768aae63570eefb9f663fb 100644 --- a/python/paddle/fluid/layers/loss.py +++ b/python/paddle/fluid/layers/loss.py @@ -1736,7 +1736,7 @@ def npair_loss(anchor, positive, labels, l2_reg=0.002): Beta = 0.25 batch_size = labels.shape[0] - labels = nn.reshape(labels, shape=[batch_size, 1], inplace=True) + labels = nn.reshape(labels, shape=[batch_size, 1]) labels = nn.expand(labels, expand_times=[1, batch_size]) labels = equal(labels, nn.transpose(labels, perm=[1, 0])).astype('float32') diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index bc9f182d95e3b728fbc0866e1c79f5508d3a04aa..22e2821973dc4298de395a2f080667ff6360fbf3 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -6109,7 +6109,7 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None): data_1 = fluid.data( name='data_1', shape=[2, 4, 6], dtype='float32') reshaped_1 = fluid.layers.reshape( - x=data_1, shape=[-1, 0, 3, 2], inplace=True) + x=data_1, shape=[-1, 0, 3, 2]) # the shape of reshaped_1 is [2,4,3,2]. # example 2: diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 9de407841fb461713d00f997afdf33a38a531245..e6ea690aa0479ccf699dbf8c09fb1bdabc3f0461 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -363,7 +363,7 @@ def roll(x, shifts, axis=None, name=None): outputs={'Out': out}, attrs={'axis': axis, 'shifts': shifts}) - out = layers.reshape(out, shape=origin_shape, inplace=True) + out = layers.reshape(out, shape=origin_shape) return out