|
|
|
@ -49,6 +49,7 @@ def create_tensor(dtype, name=None, persistable=False):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
tensor = fluid.layers.create_tensor(dtype='float32')
|
|
|
|
|
"""
|
|
|
|
|
helper = LayerHelper("create_tensor", **locals())
|
|
|
|
@ -85,6 +86,7 @@ def create_parameter(shape,
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
import paddle.fluid.layers as layers
|
|
|
|
|
W = layers.create_parameter(shape=[784, 200], dtype='float32')
|
|
|
|
|
"""
|
|
|
|
@ -123,6 +125,7 @@ def create_global_var(shape,
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
import paddle.fluid.layers as layers
|
|
|
|
|
var = layers.create_global_var(shape=[2,3], value=1.0, dtype='float32',
|
|
|
|
|
persistable=True, force_cpu=True, name='new_var')
|
|
|
|
@ -157,6 +160,7 @@ def cast(x, dtype):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
data = fluid.layers.data(name='x', shape=[13], dtype='float32')
|
|
|
|
|
result = fluid.layers.cast(x=data, dtype='float64')
|
|
|
|
|
"""
|
|
|
|
@ -190,6 +194,7 @@ def concat(input, axis=0, name=None):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
a = fluid.layers.data(name='a', shape=[2, 13], dtype='float32')
|
|
|
|
|
b = fluid.layers.data(name='b', shape=[2, 3], dtype='float32')
|
|
|
|
|
c = fluid.layers.data(name='c', shape=[2, 2], dtype='float32')
|
|
|
|
@ -482,6 +487,7 @@ def argmin(x, axis=0):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
x = fluid.layers.data(name="x", shape=[3, 4], dtype="float32")
|
|
|
|
|
out = fluid.layers.argmin(x, axis=0)
|
|
|
|
|
out = fluid.layers.argmin(x, axis=-1)
|
|
|
|
@ -514,6 +520,7 @@ def argmax(x, axis=0):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
x = fluid.layers.data(name="x", shape=[3, 4], dtype="float32")
|
|
|
|
|
out = fluid.layers.argmax(x, axis=0)
|
|
|
|
|
out = fluid.layers.argmax(x, axis=-1)
|
|
|
|
@ -565,6 +572,7 @@ def argsort(input, axis=-1, name=None):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
x = fluid.layers.data(name="x", shape=[3, 4], dtype="float32")
|
|
|
|
|
out, indices = fluid.layers.argsort(input=x, axis=0)
|
|
|
|
|
"""
|
|
|
|
@ -712,6 +720,7 @@ def save_combine(x, file_path, overwrite=True):
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
v1 = fluid.layers.data(name="data",
|
|
|
|
|
shape=(4, 6),
|
|
|
|
|
dtype="float32")
|
|
|
|
@ -808,6 +817,7 @@ def isfinite(x):
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
var = fluid.layers.data(name="data",
|
|
|
|
|
shape=(4, 6),
|
|
|
|
|
dtype="float32")
|
|
|
|
@ -843,6 +853,7 @@ def range(start, end, step, dtype):
|
|
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
data = fluid.layers.range(0, 10, 2, 'int32')
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
@ -884,6 +895,7 @@ def linspace(start, stop, num, dtype):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
data = fluid.layers.linspace(0, 10, 5, 'float32') # [0.0, 2.5, 5.0, 7.5, 10.0]
|
|
|
|
|
data = fluid.layers.linspace(0, 10, 1, 'float32') # [0.0]
|
|
|
|
|
|
|
|
|
@ -925,6 +937,7 @@ def zeros_like(x, out=None):
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
import paddle.fluid as fluid
|
|
|
|
|
x = fluid.layers.data(name='x', dtype='float32', shape=[3], append_batch_size=False)
|
|
|
|
|
data = fluid.layers.zeros_like(x) # [0.0, 0.0, 0.0]
|
|
|
|
|
|
|
|
|
|