From 8ba38e07ed51b008c1be176064420c15875558ee Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 11 May 2020 21:00:58 +0800 Subject: [PATCH] update 1.8 apis, test=develop (#2052) * update 1.8 apis, test=develop * udpate contents, test=develop --- doc/fluid/api/dygraph.rst | 6 + doc/fluid/api/dygraph/BCELoss.rst | 12 ++ doc/fluid/api/dygraph/InstanceNorm.rst | 12 ++ doc/fluid/api/{nn/loss => dygraph}/L1Loss.rst | 5 +- doc/fluid/api/dygraph/MSELoss.rst | 12 ++ doc/fluid/api/dygraph/NLLLoss.rst | 12 ++ doc/fluid/api/dygraph/ProgramTranslator.rst | 12 ++ doc/fluid/api/dygraph/declarative.rst | 11 ++ doc/fluid/api/fluid/ComplexVariable.rst | 13 ++ doc/fluid/api/gen_doc.sh | 27 --- doc/fluid/api/index_en.rst | 4 - doc/fluid/api/layers.rst | 30 +++ doc/fluid/api/layers/addcmul.rst | 11 ++ .../{tensor/math/div.rst => layers/addmm.rst} | 8 +- .../linalg/dist.rst => layers/allclose.rst} | 6 +- doc/fluid/api/layers/arange.rst | 11 ++ .../{tensor/math/pow.rst => layers/bmm.rst} | 6 +- doc/fluid/api/layers/clamp.rst | 11 ++ doc/fluid/api/layers/cross.rst | 11 ++ doc/fluid/api/layers/diag_embed.rst | 11 ++ .../{tensor/math/sqrt.rst => layers/dist.rst} | 6 +- .../{tensor/math/add.rst => layers/dot.rst} | 6 +- doc/fluid/api/layers/elementwise_equal.rst | 11 ++ .../{tensor/math/tanh.rst => layers/flip.rst} | 6 +- .../{tensor/math/atan.rst => layers/full.rst} | 6 +- doc/fluid/api/layers/full_like.rst | 11 ++ doc/fluid/api/layers/index_select.rst | 11 ++ doc/fluid/api/layers/interpolate.rst | 11 ++ .../random/rand.rst => layers/kron.rst} | 6 +- doc/fluid/api/layers/log1p.rst | 11 ++ doc/fluid/api/layers/log_softmax.rst | 11 ++ doc/fluid/api/layers/logsumexp.rst | 11 ++ doc/fluid/api/layers/meshgrid.rst | 11 ++ doc/fluid/api/layers/nonzero.rst | 11 ++ .../api/{tensor/random => layers}/randint.rst | 4 +- doc/fluid/api/layers/randn.rst | 11 ++ .../{tensor/random => layers}/randperm.rst | 4 +- doc/fluid/api/layers/roll.rst | 11 ++ .../api/{tensor/math/mm.rst => layers/t.rst} | 8 +- doc/fluid/api/layers/trace.rst | 11 ++ doc/fluid/api/layers/tril.rst | 11 ++ doc/fluid/api/layers/triu.rst | 11 ++ doc/fluid/api/nn.rst | 8 - doc/fluid/api/nn/loss.rst | 12 -- doc/fluid/api/tensor.rst | 11 -- doc/fluid/api/tensor/linalg.rst | 8 - doc/fluid/api/tensor/math.rst | 25 --- doc/fluid/api/tensor/math/elementwise_sum.rst | 11 -- doc/fluid/api/tensor/math/mul.rst | 11 -- doc/fluid/api/tensor/math/sin.rst | 11 -- doc/fluid/api/tensor/math/sum.rst | 11 -- doc/fluid/api/tensor/random.rst | 10 - doc/fluid/api_cn/dygraph_cn.rst | 7 + .../loss_cn => dygraph_cn}/BCELoss_cn.rst | 0 .../InstanceNorm_cn.rst} | 2 +- doc/fluid/api_cn/dygraph_cn/L1Loss_cn.rst | 60 ++++++ .../loss_cn => dygraph_cn}/MSELoss_cn.rst | 0 doc/fluid/api_cn/dygraph_cn/NLLLoss_cn.rst | 74 +------- .../ProgramTranslator_cn.rst} | 2 +- .../declarative_cn.txt} | 2 +- doc/fluid/api_cn/framework_cn.rst | 13 -- doc/fluid/api_cn/index_cn.rst | 4 - doc/fluid/api_cn/layers_cn.rst | 29 +++ .../{tensor_cn => layers_cn}/addcmul_cn.rst | 4 +- .../{tensor_cn => layers_cn}/addmm_cn.rst | 0 .../{tensor_cn => layers_cn}/allclose_cn.rst | 0 .../{tensor_cn => layers_cn}/arange_cn.rst | 4 +- .../{tensor_cn => layers_cn}/bmm_cn.rst | 4 +- .../{tensor_cn => layers_cn}/clamp_cn.rst | 6 +- .../{tensor_cn => layers_cn}/cross_cn.rst | 6 +- .../{nn_cn => layers_cn}/diag_embed_cn.rst | 0 .../{tensor_cn => layers_cn}/dist_cn.rst | 10 +- .../{tensor_cn => layers_cn}/dot_cn.rst | 4 +- .../elementwise_equal_cn.rst | 4 +- .../{tensor_cn => layers_cn}/flip_cn.rst | 4 +- .../{tensor_cn => layers_cn}/full_cn.rst | 0 .../{tensor_cn => layers_cn}/full_like_cn.rst | 4 +- .../index_select_cn.rst | 6 +- .../{nn_cn => layers_cn}/interpolate_cn.rst | 0 .../{tensor_cn => layers_cn}/kron_cn.rst | 4 +- .../{tensor_cn => layers_cn}/log1p_cn.rst | 4 +- .../{nn_cn => layers_cn}/log_softmax_cn.rst | 0 .../{tensor_cn => layers_cn}/logsumexp_cn.rst | 8 +- .../{tensor_cn => layers_cn}/meshgrid_cn.rst | 0 .../{tensor_cn => layers_cn}/nonzero_cn.rst | 14 +- doc/fluid/api_cn/layers_cn/randint_cn.rst | 55 +----- .../{tensor_cn => layers_cn}/randn_cn.rst | 6 +- .../{tensor_cn => layers_cn}/randperm_cn.rst | 10 +- .../{tensor_cn => layers_cn}/roll_cn.rst | 6 +- .../api_cn/{tensor_cn => layers_cn}/t_cn.rst | 10 +- .../trace_cn.rst} | 4 +- .../{tensor_cn => layers_cn}/tril_cn.rst | 0 .../{tensor_cn => layers_cn}/triu_cn.rst | 0 doc/fluid/api_cn/nn_cn.rst | 20 -- doc/fluid/api_cn/nn_cn/Conv2D_cn.rst | 3 - doc/fluid/api_cn/nn_cn/Linear_cn.rst | 3 - doc/fluid/api_cn/nn_cn/ReLU_cn.rst | 3 - doc/fluid/api_cn/nn_cn/Upsample_cn.rst | 3 - doc/fluid/api_cn/nn_cn/activation_cn.rst | 11 -- .../api_cn/nn_cn/activation_cn/Sigmoid_cn.rst | 3 - doc/fluid/api_cn/nn_cn/loss_cn.rst | 15 -- .../nn_cn/loss_cn/CrossEntropyLoss_cn.rst | 3 - doc/fluid/api_cn/nn_cn/loss_cn/L1Loss_cn.rst | 3 - doc/fluid/api_cn/nn_cn/loss_cn/NLLLoss_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/add_cn.rst | 173 ------------------ doc/fluid/api_cn/tensor_cn/argmax_cn.rst | 63 ------- doc/fluid/api_cn/tensor_cn/atan_cn.rst | 38 ---- doc/fluid/api_cn/tensor_cn/cholesky_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/concat_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/div_cn.rst | 154 ---------------- doc/fluid/api_cn/tensor_cn/einsum_cn.rst | 3 - .../api_cn/tensor_cn/elementwise_sum_cn.rst | 75 -------- doc/fluid/api_cn/tensor_cn/equal_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/erf_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/eye_cn.rst | 38 ---- doc/fluid/api_cn/tensor_cn/gather_cn.rst | 35 ---- doc/fluid/api_cn/tensor_cn/inverse_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/isnan_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/linspace_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/math_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/matmul_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/max_cn.rst | 54 ------ doc/fluid/api_cn/tensor_cn/min_cn.rst | 53 ------ doc/fluid/api_cn/tensor_cn/mm_cn.rst | 74 -------- doc/fluid/api_cn/tensor_cn/mul_cn.rst | 45 ----- doc/fluid/api_cn/tensor_cn/norm_cn.rst | 38 ---- doc/fluid/api_cn/tensor_cn/ones_cn.rst | 28 --- doc/fluid/api_cn/tensor_cn/ones_like_cn.rst | 29 --- doc/fluid/api_cn/tensor_cn/pow_cn.rst | 41 ----- doc/fluid/api_cn/tensor_cn/rand_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/randint_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/sin_cn.rst | 38 ---- doc/fluid/api_cn/tensor_cn/sort_cn.rst | 69 ------- doc/fluid/api_cn/tensor_cn/split_cn.rst | 34 ---- doc/fluid/api_cn/tensor_cn/sqrt_cn.rst | 42 ----- doc/fluid/api_cn/tensor_cn/squeeze_cn.rst | 31 ---- doc/fluid/api_cn/tensor_cn/stack_cn.rst | 36 ---- doc/fluid/api_cn/tensor_cn/std_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/sum_cn.rst | 43 ----- doc/fluid/api_cn/tensor_cn/tanh_cn.rst | 40 ---- doc/fluid/api_cn/tensor_cn/tensordot_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/transpose_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/unbind_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/unsqueeze_cn.rst | 31 ---- doc/fluid/api_cn/tensor_cn/var_cn.rst | 3 - doc/fluid/api_cn/tensor_cn/zeros_cn.rst | 27 --- doc/fluid/api_cn/tensor_cn/zeros_like_cn.rst | 29 --- 147 files changed, 527 insertions(+), 1871 deletions(-) create mode 100644 doc/fluid/api/dygraph/BCELoss.rst create mode 100644 doc/fluid/api/dygraph/InstanceNorm.rst rename doc/fluid/api/{nn/loss => dygraph}/L1Loss.rst (60%) create mode 100644 doc/fluid/api/dygraph/MSELoss.rst create mode 100644 doc/fluid/api/dygraph/NLLLoss.rst create mode 100644 doc/fluid/api/dygraph/ProgramTranslator.rst create mode 100644 doc/fluid/api/dygraph/declarative.rst create mode 100644 doc/fluid/api/fluid/ComplexVariable.rst create mode 100644 doc/fluid/api/layers/addcmul.rst rename doc/fluid/api/{tensor/math/div.rst => layers/addmm.rst} (54%) rename doc/fluid/api/{tensor/linalg/dist.rst => layers/allclose.rst} (56%) create mode 100644 doc/fluid/api/layers/arange.rst rename doc/fluid/api/{tensor/math/pow.rst => layers/bmm.rst} (59%) create mode 100644 doc/fluid/api/layers/clamp.rst create mode 100644 doc/fluid/api/layers/cross.rst create mode 100644 doc/fluid/api/layers/diag_embed.rst rename doc/fluid/api/{tensor/math/sqrt.rst => layers/dist.rst} (58%) rename doc/fluid/api/{tensor/math/add.rst => layers/dot.rst} (59%) create mode 100644 doc/fluid/api/layers/elementwise_equal.rst rename doc/fluid/api/{tensor/math/tanh.rst => layers/flip.rst} (58%) rename doc/fluid/api/{tensor/math/atan.rst => layers/full.rst} (58%) create mode 100644 doc/fluid/api/layers/full_like.rst create mode 100644 doc/fluid/api/layers/index_select.rst create mode 100644 doc/fluid/api/layers/interpolate.rst rename doc/fluid/api/{tensor/random/rand.rst => layers/kron.rst} (58%) create mode 100644 doc/fluid/api/layers/log1p.rst create mode 100644 doc/fluid/api/layers/log_softmax.rst create mode 100644 doc/fluid/api/layers/logsumexp.rst create mode 100644 doc/fluid/api/layers/meshgrid.rst create mode 100644 doc/fluid/api/layers/nonzero.rst rename doc/fluid/api/{tensor/random => layers}/randint.rst (60%) create mode 100644 doc/fluid/api/layers/randn.rst rename doc/fluid/api/{tensor/random => layers}/randperm.rst (59%) create mode 100644 doc/fluid/api/layers/roll.rst rename doc/fluid/api/{tensor/math/mm.rst => layers/t.rst} (59%) create mode 100644 doc/fluid/api/layers/trace.rst create mode 100644 doc/fluid/api/layers/tril.rst create mode 100644 doc/fluid/api/layers/triu.rst delete mode 100644 doc/fluid/api/nn.rst delete mode 100644 doc/fluid/api/nn/loss.rst delete mode 100644 doc/fluid/api/tensor.rst delete mode 100644 doc/fluid/api/tensor/linalg.rst delete mode 100644 doc/fluid/api/tensor/math.rst delete mode 100644 doc/fluid/api/tensor/math/elementwise_sum.rst delete mode 100644 doc/fluid/api/tensor/math/mul.rst delete mode 100644 doc/fluid/api/tensor/math/sin.rst delete mode 100644 doc/fluid/api/tensor/math/sum.rst delete mode 100644 doc/fluid/api/tensor/random.rst rename doc/fluid/api_cn/{nn_cn/loss_cn => dygraph_cn}/BCELoss_cn.rst (100%) rename doc/fluid/api_cn/{framework_cn/manual_seed_cn.rst => dygraph_cn/InstanceNorm_cn.rst} (84%) create mode 100644 doc/fluid/api_cn/dygraph_cn/L1Loss_cn.rst rename doc/fluid/api_cn/{nn_cn/loss_cn => dygraph_cn}/MSELoss_cn.rst (100%) rename doc/fluid/api_cn/{nn_cn/Conv1D_cn.rst => dygraph_cn/ProgramTranslator_cn.rst} (80%) rename doc/fluid/api_cn/{framework_cn/get_default_dtype_cn.rst => dygraph_cn/declarative_cn.txt} (85%) delete mode 100644 doc/fluid/api_cn/framework_cn.rst rename doc/fluid/api_cn/{tensor_cn => layers_cn}/addcmul_cn.rst (90%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/addmm_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/allclose_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/arange_cn.rst (88%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/bmm_cn.rst (93%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/clamp_cn.rst (89%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/cross_cn.rst (89%) rename doc/fluid/api_cn/{nn_cn => layers_cn}/diag_embed_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/dist_cn.rst (91%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/dot_cn.rst (92%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/elementwise_equal_cn.rst (85%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/flip_cn.rst (93%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/full_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/full_like_cn.rst (91%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/index_select_cn.rst (88%) rename doc/fluid/api_cn/{nn_cn => layers_cn}/interpolate_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/kron_cn.rst (95%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/log1p_cn.rst (90%) rename doc/fluid/api_cn/{nn_cn => layers_cn}/log_softmax_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/logsumexp_cn.rst (86%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/meshgrid_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/nonzero_cn.rst (83%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/randn_cn.rst (91%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/randperm_cn.rst (84%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/roll_cn.rst (88%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/t_cn.rst (80%) rename doc/fluid/api_cn/{framework_cn/set_default_dtype_cn.rst => layers_cn/trace_cn.rst} (90%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/tril_cn.rst (100%) rename doc/fluid/api_cn/{tensor_cn => layers_cn}/triu_cn.rst (100%) delete mode 100644 doc/fluid/api_cn/nn_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/Conv2D_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/Linear_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/ReLU_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/Upsample_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/activation_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/activation_cn/Sigmoid_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/loss_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/loss_cn/CrossEntropyLoss_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/loss_cn/L1Loss_cn.rst delete mode 100644 doc/fluid/api_cn/nn_cn/loss_cn/NLLLoss_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/add_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/argmax_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/atan_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/cholesky_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/concat_cn.rst delete mode 100755 doc/fluid/api_cn/tensor_cn/div_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/einsum_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/elementwise_sum_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/equal_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/erf_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/eye_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/gather_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/inverse_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/isnan_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/linspace_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/math_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/matmul_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/max_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/min_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/mm_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/mul_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/norm_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/ones_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/ones_like_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/pow_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/rand_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/randint_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/sin_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/sort_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/split_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/sqrt_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/squeeze_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/stack_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/std_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/sum_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/tanh_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/tensordot_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/transpose_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/unbind_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/unsqueeze_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/var_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/zeros_cn.rst delete mode 100644 doc/fluid/api_cn/tensor_cn/zeros_like_cn.rst diff --git a/doc/fluid/api/dygraph.rst b/doc/fluid/api/dygraph.rst index ac8ca0521..0559cd477 100644 --- a/doc/fluid/api/dygraph.rst +++ b/doc/fluid/api/dygraph.rst @@ -7,6 +7,7 @@ fluid.dygraph dygraph/BackwardStrategy.rst dygraph/BatchNorm.rst + dygraph/BCELoss.rst dygraph/BilinearTensorProduct.rst dygraph/Conv2D.rst dygraph/Conv2DTranspose.rst @@ -27,17 +28,22 @@ fluid.dygraph dygraph/ExponentialDecay.rst dygraph/grad.rst dygraph/GroupNorm.rst + dygraph/GRUCell.rst dygraph/GRUUnit.rst dygraph/guard.rst dygraph/InstanceNorm.rst dygraph/InverseTimeDecay.rst + dygraph/L1Loss.rst dygraph/Layer.rst dygraph/LayerList.rst dygraph/LayerNorm.rst dygraph/Linear.rst dygraph/load_dygraph.rst + dygraph/LSTMCell.rst + dygraph/MSELoss.rst dygraph/NaturalExpDecay.rst dygraph/NCE.rst + dygraph/NLLLoss.rst dygraph/no_grad.rst dygraph/NoamDecay.rst dygraph/ParallelEnv.rst diff --git a/doc/fluid/api/dygraph/BCELoss.rst b/doc/fluid/api/dygraph/BCELoss.rst new file mode 100644 index 000000000..9e4e9a78f --- /dev/null +++ b/doc/fluid/api/dygraph/BCELoss.rst @@ -0,0 +1,12 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_BCELoss: + +BCELoss +------- + +.. autoclass:: paddle.fluid.dygraph.BCELoss + :members: + :noindex: + diff --git a/doc/fluid/api/dygraph/InstanceNorm.rst b/doc/fluid/api/dygraph/InstanceNorm.rst new file mode 100644 index 000000000..548185e89 --- /dev/null +++ b/doc/fluid/api/dygraph/InstanceNorm.rst @@ -0,0 +1,12 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_InstanceNorm: + +InstanceNorm +------------ + +.. autoclass:: paddle.fluid.dygraph.InstanceNorm + :members: + :noindex: + diff --git a/doc/fluid/api/nn/loss/L1Loss.rst b/doc/fluid/api/dygraph/L1Loss.rst similarity index 60% rename from doc/fluid/api/nn/loss/L1Loss.rst rename to doc/fluid/api/dygraph/L1Loss.rst index 161cb38c8..2d0f7c81f 100644 --- a/doc/fluid/api/nn/loss/L1Loss.rst +++ b/doc/fluid/api/dygraph/L1Loss.rst @@ -1,13 +1,12 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_nn_loss_L1Loss: +.. _api_fluid_dygraph_L1Loss: L1Loss ------ -.. autoclass:: paddle.nn.loss.L1Loss +.. autoclass:: paddle.fluid.dygraph.L1Loss :members: - :inherited-members: :noindex: diff --git a/doc/fluid/api/dygraph/MSELoss.rst b/doc/fluid/api/dygraph/MSELoss.rst new file mode 100644 index 000000000..054080b7a --- /dev/null +++ b/doc/fluid/api/dygraph/MSELoss.rst @@ -0,0 +1,12 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_MSELoss: + +MSELoss +------- + +.. autoclass:: paddle.fluid.dygraph.MSELoss + :members: + :noindex: + diff --git a/doc/fluid/api/dygraph/NLLLoss.rst b/doc/fluid/api/dygraph/NLLLoss.rst new file mode 100644 index 000000000..f40437cd0 --- /dev/null +++ b/doc/fluid/api/dygraph/NLLLoss.rst @@ -0,0 +1,12 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_NLLLoss: + +NLLLoss +------- + +.. autoclass:: paddle.fluid.dygraph.NLLLoss + :members: + :noindex: + diff --git a/doc/fluid/api/dygraph/ProgramTranslator.rst b/doc/fluid/api/dygraph/ProgramTranslator.rst new file mode 100644 index 000000000..ac995abd2 --- /dev/null +++ b/doc/fluid/api/dygraph/ProgramTranslator.rst @@ -0,0 +1,12 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_ProgramTranslator: + +ProgramTranslator +----------------- + +.. autoclass:: paddle.fluid.dygraph.ProgramTranslator + :members: + :noindex: + diff --git a/doc/fluid/api/dygraph/declarative.rst b/doc/fluid/api/dygraph/declarative.rst new file mode 100644 index 000000000..4d603e862 --- /dev/null +++ b/doc/fluid/api/dygraph/declarative.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_dygraph_declarative: + +declarative +----------- + +.. autofunction:: paddle.fluid.dygraph.declarative + :noindex: + diff --git a/doc/fluid/api/fluid/ComplexVariable.rst b/doc/fluid/api/fluid/ComplexVariable.rst new file mode 100644 index 000000000..071457e8c --- /dev/null +++ b/doc/fluid/api/fluid/ComplexVariable.rst @@ -0,0 +1,13 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_ComplexVariable: + +ComplexVariable +--------------- + +.. autoclass:: paddle.fluid.ComplexVariable + :members: + :inherited-members: + :noindex: + diff --git a/doc/fluid/api/gen_doc.sh b/doc/fluid/api/gen_doc.sh index 4f549e17c..19c07cc21 100644 --- a/doc/fluid/api/gen_doc.sh +++ b/doc/fluid/api/gen_doc.sh @@ -10,33 +10,6 @@ done python gen_doc.py --module_name "" --module_prefix "" --output fluid --output_name fluid --to_multiple_files True python gen_module_index.py fluid fluid -# tensor -for module in math random stat -do - python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name tensor --to_multiple_files True --output_dir tensor - python gen_module_index.py tensor.${module} ${module} -done - -python gen_module_index.py tensor paddle.tensor - -for module in math manipulation -do - python gen_doc.py --module_name tensor.${module} --module_prefix tensor.${module} --output tensor/${module} --output_name complex --to_multiple_files True --output_dir complex - python gen_module_index.py complex.tensor.${module} ${module} -done - -python gen_module_index.py complex.tensor tensor -python gen_module_index.py complex paddle.complex - -# nn -for module in loss -do - python gen_doc.py --module_name ${module} --module_prefix ${module} --output ${module} --output_name nn --to_multiple_files True --output_dir nn - python gen_module_index.py nn.${module} ${module} -done - -python gen_doc.py --module_name "" --module_prefix "" --output nn --output_name nn --to_multiple_files True -python gen_module_index.py nn paddle.nn # index.rst python gen_index.py diff --git a/doc/fluid/api/index_en.rst b/doc/fluid/api/index_en.rst index fee4b69e3..dce0d7cf9 100644 --- a/doc/fluid/api/index_en.rst +++ b/doc/fluid/api/index_en.rst @@ -6,9 +6,6 @@ API Reference :maxdepth: 1 ../api_guides/index_en.rst - complex.rst - nn.rst - tensor.rst fluid.rst backward.rst clip.rst @@ -17,7 +14,6 @@ API Reference dataset.rst dygraph.rst executor.rst - index.rst initializer.rst io.rst layers.rst diff --git a/doc/fluid/api/layers.rst b/doc/fluid/api/layers.rst index 3ad2eeaa2..9244c5c11 100644 --- a/doc/fluid/api/layers.rst +++ b/doc/fluid/api/layers.rst @@ -11,9 +11,13 @@ fluid.layers layers/adaptive_pool2d.rst layers/adaptive_pool3d.rst layers/add_position_encoding.rst + layers/addcmul.rst + layers/addmm.rst layers/affine_channel.rst layers/affine_grid.rst + layers/allclose.rst layers/anchor_generator.rst + layers/arange.rst layers/argmax.rst layers/argmin.rst layers/argsort.rst @@ -32,6 +36,7 @@ fluid.layers layers/BeamSearchDecoder.rst layers/bilinear_tensor_product.rst layers/bipartite_match.rst + layers/bmm.rst layers/box_clip.rst layers/box_coder.rst layers/box_decoder_and_assign.rst @@ -43,6 +48,7 @@ fluid.layers layers/ceil.rst layers/center_loss.rst layers/chunk_eval.rst + layers/clamp.rst layers/clip.rst layers/clip_by_norm.rst layers/collect_fpn_proposals.rst @@ -64,6 +70,7 @@ fluid.layers layers/crf_decoding.rst layers/crop.rst layers/crop_tensor.rst + layers/cross.rst layers/cross_entropy.rst layers/ctc_greedy_decoder.rst layers/cumsum.rst @@ -76,8 +83,11 @@ fluid.layers layers/density_prior_box.rst layers/detection_output.rst layers/diag.rst + layers/diag_embed.rst layers/dice_loss.rst + layers/dist.rst layers/distribute_fpn_proposals.rst + layers/dot.rst layers/double_buffer.rst layers/dropout.rst layers/dynamic_decode.rst @@ -88,6 +98,7 @@ fluid.layers layers/edit_distance.rst layers/elementwise_add.rst layers/elementwise_div.rst + layers/elementwise_equal.rst layers/elementwise_floordiv.rst layers/elementwise_max.rst layers/elementwise_min.rst @@ -109,8 +120,11 @@ fluid.layers layers/fill_constant_batch_size_like.rst layers/filter_by_instag.rst layers/flatten.rst + layers/flip.rst layers/floor.rst layers/fsp_matrix.rst + layers/full.rst + layers/full_like.rst layers/gather.rst layers/gather_nd.rst layers/gather_tree.rst @@ -141,13 +155,16 @@ fluid.layers layers/image_resize.rst layers/image_resize_short.rst layers/increment.rst + layers/index_select.rst layers/inplace_abn.rst layers/instance_norm.rst + layers/interpolate.rst layers/inverse_time_decay.rst layers/iou_similarity.rst layers/is_empty.rst layers/isfinite.rst layers/kldiv_loss.rst + layers/kron.rst layers/l2_normalize.rst layers/label_smooth.rst layers/layer_norm.rst @@ -162,12 +179,15 @@ fluid.layers layers/lod_append.rst layers/lod_reset.rst layers/log.rst + layers/log1p.rst layers/log_loss.rst + layers/log_softmax.rst layers/logical_and.rst layers/logical_not.rst layers/logical_or.rst layers/logical_xor.rst layers/logsigmoid.rst + layers/logsumexp.rst layers/lrn.rst layers/lstm.rst layers/lstm_unit.rst @@ -178,6 +198,7 @@ fluid.layers layers/mean.rst layers/mean_iou.rst layers/merge_selected_rows.rst + layers/meshgrid.rst layers/mse_loss.rst layers/mul.rst layers/multi_box_head.rst @@ -187,6 +208,7 @@ fluid.layers layers/natural_exp_decay.rst layers/nce.rst layers/noam_decay.rst + layers/nonzero.rst layers/Normal.rst layers/not_equal.rst layers/npair_loss.rst @@ -210,7 +232,10 @@ fluid.layers layers/psroi_pool.rst layers/py_func.rst layers/py_reader.rst + layers/randint.rst + layers/randn.rst layers/random_crop.rst + layers/randperm.rst layers/range.rst layers/rank.rst layers/rank_loss.rst @@ -238,6 +263,7 @@ fluid.layers layers/roi_align.rst layers/roi_perspective_transform.rst layers/roi_pool.rst + layers/roll.rst layers/round.rst layers/row_conv.rst layers/rpn_target_assign.rst @@ -301,6 +327,7 @@ fluid.layers layers/swish.rst layers/Switch.rst layers/switch_case.rst + layers/t.rst layers/tanh.rst layers/tanh_shrink.rst layers/target_assign.rst @@ -309,8 +336,11 @@ fluid.layers layers/tensor_array_to_tensor.rst layers/thresholded_relu.rst layers/topk.rst + layers/trace.rst layers/TrainingHelper.rst layers/transpose.rst + layers/tril.rst + layers/triu.rst layers/unfold.rst layers/Uniform.rst layers/uniform_random.rst diff --git a/doc/fluid/api/layers/addcmul.rst b/doc/fluid/api/layers/addcmul.rst new file mode 100644 index 000000000..834cb76ea --- /dev/null +++ b/doc/fluid/api/layers/addcmul.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_addcmul: + +addcmul +------- + +.. autofunction:: paddle.fluid.layers.addcmul + :noindex: + diff --git a/doc/fluid/api/tensor/math/div.rst b/doc/fluid/api/layers/addmm.rst similarity index 54% rename from doc/fluid/api/tensor/math/div.rst rename to doc/fluid/api/layers/addmm.rst index cf8397dbf..509c5fb37 100644 --- a/doc/fluid/api/tensor/math/div.rst +++ b/doc/fluid/api/layers/addmm.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_div: +.. _api_fluid_layers_addmm: -div ---- +addmm +----- -.. autofunction:: paddle.tensor.math.div +.. autofunction:: paddle.fluid.layers.addmm :noindex: diff --git a/doc/fluid/api/tensor/linalg/dist.rst b/doc/fluid/api/layers/allclose.rst similarity index 56% rename from doc/fluid/api/tensor/linalg/dist.rst rename to doc/fluid/api/layers/allclose.rst index 6ca92b536..8f8758be6 100644 --- a/doc/fluid/api/tensor/linalg/dist.rst +++ b/doc/fluid/api/layers/allclose.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_linalg_dist: +.. _api_fluid_layers_allclose: -dist +allclose -------- -.. autofunction:: paddle.tensor.linalg.dist +.. autofunction:: paddle.fluid.layers.allclose :noindex: diff --git a/doc/fluid/api/layers/arange.rst b/doc/fluid/api/layers/arange.rst new file mode 100644 index 000000000..8a0e51627 --- /dev/null +++ b/doc/fluid/api/layers/arange.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_arange: + +arange +------ + +.. autofunction:: paddle.fluid.layers.arange + :noindex: + diff --git a/doc/fluid/api/tensor/math/pow.rst b/doc/fluid/api/layers/bmm.rst similarity index 59% rename from doc/fluid/api/tensor/math/pow.rst rename to doc/fluid/api/layers/bmm.rst index 5d0da558d..b78ec587e 100644 --- a/doc/fluid/api/tensor/math/pow.rst +++ b/doc/fluid/api/layers/bmm.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_pow: +.. _api_fluid_layers_bmm: -pow +bmm --- -.. autofunction:: paddle.tensor.math.pow +.. autofunction:: paddle.fluid.layers.bmm :noindex: diff --git a/doc/fluid/api/layers/clamp.rst b/doc/fluid/api/layers/clamp.rst new file mode 100644 index 000000000..e5cdcc611 --- /dev/null +++ b/doc/fluid/api/layers/clamp.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_clamp: + +clamp +----- + +.. autofunction:: paddle.fluid.layers.clamp + :noindex: + diff --git a/doc/fluid/api/layers/cross.rst b/doc/fluid/api/layers/cross.rst new file mode 100644 index 000000000..1d147d8e8 --- /dev/null +++ b/doc/fluid/api/layers/cross.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_cross: + +cross +----- + +.. autofunction:: paddle.fluid.layers.cross + :noindex: + diff --git a/doc/fluid/api/layers/diag_embed.rst b/doc/fluid/api/layers/diag_embed.rst new file mode 100644 index 000000000..1fbbb99ad --- /dev/null +++ b/doc/fluid/api/layers/diag_embed.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_diag_embed: + +diag_embed +---------- + +.. autofunction:: paddle.fluid.layers.diag_embed + :noindex: + diff --git a/doc/fluid/api/tensor/math/sqrt.rst b/doc/fluid/api/layers/dist.rst similarity index 58% rename from doc/fluid/api/tensor/math/sqrt.rst rename to doc/fluid/api/layers/dist.rst index c0ad25799..d7cf6d5e2 100644 --- a/doc/fluid/api/tensor/math/sqrt.rst +++ b/doc/fluid/api/layers/dist.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_sqrt: +.. _api_fluid_layers_dist: -sqrt +dist ---- -.. autofunction:: paddle.tensor.math.sqrt +.. autofunction:: paddle.fluid.layers.dist :noindex: diff --git a/doc/fluid/api/tensor/math/add.rst b/doc/fluid/api/layers/dot.rst similarity index 59% rename from doc/fluid/api/tensor/math/add.rst rename to doc/fluid/api/layers/dot.rst index 0b604ac2d..995066917 100644 --- a/doc/fluid/api/tensor/math/add.rst +++ b/doc/fluid/api/layers/dot.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_add: +.. _api_fluid_layers_dot: -add +dot --- -.. autofunction:: paddle.tensor.math.add +.. autofunction:: paddle.fluid.layers.dot :noindex: diff --git a/doc/fluid/api/layers/elementwise_equal.rst b/doc/fluid/api/layers/elementwise_equal.rst new file mode 100644 index 000000000..25671bec7 --- /dev/null +++ b/doc/fluid/api/layers/elementwise_equal.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_elementwise_equal: + +elementwise_equal +----------------- + +.. autofunction:: paddle.fluid.layers.elementwise_equal + :noindex: + diff --git a/doc/fluid/api/tensor/math/tanh.rst b/doc/fluid/api/layers/flip.rst similarity index 58% rename from doc/fluid/api/tensor/math/tanh.rst rename to doc/fluid/api/layers/flip.rst index ceb5971e0..ad7f9c805 100644 --- a/doc/fluid/api/tensor/math/tanh.rst +++ b/doc/fluid/api/layers/flip.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_tanh: +.. _api_fluid_layers_flip: -tanh +flip ---- -.. autofunction:: paddle.tensor.math.tanh +.. autofunction:: paddle.fluid.layers.flip :noindex: diff --git a/doc/fluid/api/tensor/math/atan.rst b/doc/fluid/api/layers/full.rst similarity index 58% rename from doc/fluid/api/tensor/math/atan.rst rename to doc/fluid/api/layers/full.rst index 31b11dbbe..5cec242c2 100644 --- a/doc/fluid/api/tensor/math/atan.rst +++ b/doc/fluid/api/layers/full.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_atan: +.. _api_fluid_layers_full: -atan +full ---- -.. autofunction:: paddle.tensor.math.atan +.. autofunction:: paddle.fluid.layers.full :noindex: diff --git a/doc/fluid/api/layers/full_like.rst b/doc/fluid/api/layers/full_like.rst new file mode 100644 index 000000000..9d27a0228 --- /dev/null +++ b/doc/fluid/api/layers/full_like.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_full_like: + +full_like +--------- + +.. autofunction:: paddle.fluid.layers.full_like + :noindex: + diff --git a/doc/fluid/api/layers/index_select.rst b/doc/fluid/api/layers/index_select.rst new file mode 100644 index 000000000..b91f1d605 --- /dev/null +++ b/doc/fluid/api/layers/index_select.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_index_select: + +index_select +------------ + +.. autofunction:: paddle.fluid.layers.index_select + :noindex: + diff --git a/doc/fluid/api/layers/interpolate.rst b/doc/fluid/api/layers/interpolate.rst new file mode 100644 index 000000000..4dae3a131 --- /dev/null +++ b/doc/fluid/api/layers/interpolate.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_interpolate: + +interpolate +----------- + +.. autofunction:: paddle.fluid.layers.interpolate + :noindex: + diff --git a/doc/fluid/api/tensor/random/rand.rst b/doc/fluid/api/layers/kron.rst similarity index 58% rename from doc/fluid/api/tensor/random/rand.rst rename to doc/fluid/api/layers/kron.rst index 7ad959e99..90f24343a 100644 --- a/doc/fluid/api/tensor/random/rand.rst +++ b/doc/fluid/api/layers/kron.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_random_rand: +.. _api_fluid_layers_kron: -rand +kron ---- -.. autofunction:: paddle.tensor.random.rand +.. autofunction:: paddle.fluid.layers.kron :noindex: diff --git a/doc/fluid/api/layers/log1p.rst b/doc/fluid/api/layers/log1p.rst new file mode 100644 index 000000000..315d3e50b --- /dev/null +++ b/doc/fluid/api/layers/log1p.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_log1p: + +log1p +----- + +.. autofunction:: paddle.fluid.layers.log1p + :noindex: + diff --git a/doc/fluid/api/layers/log_softmax.rst b/doc/fluid/api/layers/log_softmax.rst new file mode 100644 index 000000000..15aee0302 --- /dev/null +++ b/doc/fluid/api/layers/log_softmax.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_log_softmax: + +log_softmax +----------- + +.. autofunction:: paddle.fluid.layers.log_softmax + :noindex: + diff --git a/doc/fluid/api/layers/logsumexp.rst b/doc/fluid/api/layers/logsumexp.rst new file mode 100644 index 000000000..57c366f8e --- /dev/null +++ b/doc/fluid/api/layers/logsumexp.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_logsumexp: + +logsumexp +--------- + +.. autofunction:: paddle.fluid.layers.logsumexp + :noindex: + diff --git a/doc/fluid/api/layers/meshgrid.rst b/doc/fluid/api/layers/meshgrid.rst new file mode 100644 index 000000000..d81b95c0c --- /dev/null +++ b/doc/fluid/api/layers/meshgrid.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_meshgrid: + +meshgrid +-------- + +.. autofunction:: paddle.fluid.layers.meshgrid + :noindex: + diff --git a/doc/fluid/api/layers/nonzero.rst b/doc/fluid/api/layers/nonzero.rst new file mode 100644 index 000000000..7eef8c358 --- /dev/null +++ b/doc/fluid/api/layers/nonzero.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_nonzero: + +nonzero +------- + +.. autofunction:: paddle.fluid.layers.nonzero + :noindex: + diff --git a/doc/fluid/api/tensor/random/randint.rst b/doc/fluid/api/layers/randint.rst similarity index 60% rename from doc/fluid/api/tensor/random/randint.rst rename to doc/fluid/api/layers/randint.rst index e5a9d6139..4cccc52e4 100644 --- a/doc/fluid/api/tensor/random/randint.rst +++ b/doc/fluid/api/layers/randint.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_random_randint: +.. _api_fluid_layers_randint: randint ------- -.. autofunction:: paddle.tensor.random.randint +.. autofunction:: paddle.fluid.layers.randint :noindex: diff --git a/doc/fluid/api/layers/randn.rst b/doc/fluid/api/layers/randn.rst new file mode 100644 index 000000000..b58b052d4 --- /dev/null +++ b/doc/fluid/api/layers/randn.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_randn: + +randn +----- + +.. autofunction:: paddle.fluid.layers.randn + :noindex: + diff --git a/doc/fluid/api/tensor/random/randperm.rst b/doc/fluid/api/layers/randperm.rst similarity index 59% rename from doc/fluid/api/tensor/random/randperm.rst rename to doc/fluid/api/layers/randperm.rst index 0aa4cc612..523a3b7a5 100644 --- a/doc/fluid/api/tensor/random/randperm.rst +++ b/doc/fluid/api/layers/randperm.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_random_randperm: +.. _api_fluid_layers_randperm: randperm -------- -.. autofunction:: paddle.tensor.random.randperm +.. autofunction:: paddle.fluid.layers.randperm :noindex: diff --git a/doc/fluid/api/layers/roll.rst b/doc/fluid/api/layers/roll.rst new file mode 100644 index 000000000..f6744e12a --- /dev/null +++ b/doc/fluid/api/layers/roll.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_roll: + +roll +---- + +.. autofunction:: paddle.fluid.layers.roll + :noindex: + diff --git a/doc/fluid/api/tensor/math/mm.rst b/doc/fluid/api/layers/t.rst similarity index 59% rename from doc/fluid/api/tensor/math/mm.rst rename to doc/fluid/api/layers/t.rst index 8668c4405..6a52eade1 100644 --- a/doc/fluid/api/tensor/math/mm.rst +++ b/doc/fluid/api/layers/t.rst @@ -1,11 +1,11 @@ .. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` !DO NOT EDIT THIS FILE MANUALLY! -.. _api_tensor_math_mm: +.. _api_fluid_layers_t: -mm --- +t +- -.. autofunction:: paddle.tensor.math.mm +.. autofunction:: paddle.fluid.layers.t :noindex: diff --git a/doc/fluid/api/layers/trace.rst b/doc/fluid/api/layers/trace.rst new file mode 100644 index 000000000..b189e1782 --- /dev/null +++ b/doc/fluid/api/layers/trace.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_trace: + +trace +----- + +.. autofunction:: paddle.fluid.layers.trace + :noindex: + diff --git a/doc/fluid/api/layers/tril.rst b/doc/fluid/api/layers/tril.rst new file mode 100644 index 000000000..e9e4a88f0 --- /dev/null +++ b/doc/fluid/api/layers/tril.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_tril: + +tril +---- + +.. autofunction:: paddle.fluid.layers.tril + :noindex: + diff --git a/doc/fluid/api/layers/triu.rst b/doc/fluid/api/layers/triu.rst new file mode 100644 index 000000000..25d6a074e --- /dev/null +++ b/doc/fluid/api/layers/triu.rst @@ -0,0 +1,11 @@ +.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` + !DO NOT EDIT THIS FILE MANUALLY! + +.. _api_fluid_layers_triu: + +triu +---- + +.. autofunction:: paddle.fluid.layers.triu + :noindex: + diff --git a/doc/fluid/api/nn.rst b/doc/fluid/api/nn.rst deleted file mode 100644 index 362b033a8..000000000 --- a/doc/fluid/api/nn.rst +++ /dev/null @@ -1,8 +0,0 @@ -========= -paddle.nn -========= - -.. toctree:: - :maxdepth: 1 - - nn/loss.rst diff --git a/doc/fluid/api/nn/loss.rst b/doc/fluid/api/nn/loss.rst deleted file mode 100644 index bbbf4faa1..000000000 --- a/doc/fluid/api/nn/loss.rst +++ /dev/null @@ -1,12 +0,0 @@ -==== -loss -==== - -.. toctree:: - :maxdepth: 1 - - loss/BCELoss.rst - loss/CrossEntropyLoss.rst - loss/L1Loss.rst - loss/MSELoss.rst - loss/NLLLoss.rst diff --git a/doc/fluid/api/tensor.rst b/doc/fluid/api/tensor.rst deleted file mode 100644 index c9b3bac88..000000000 --- a/doc/fluid/api/tensor.rst +++ /dev/null @@ -1,11 +0,0 @@ -============= -paddle.tensor -============= - -.. toctree:: - :maxdepth: 1 - - tensor/linalg.rst - tensor/math.rst - tensor/random.rst - tensor/stat.rst diff --git a/doc/fluid/api/tensor/linalg.rst b/doc/fluid/api/tensor/linalg.rst deleted file mode 100644 index 08cabf1c4..000000000 --- a/doc/fluid/api/tensor/linalg.rst +++ /dev/null @@ -1,8 +0,0 @@ -====== -linalg -====== - -.. toctree:: - :maxdepth: 1 - - linalg/dist.rst diff --git a/doc/fluid/api/tensor/math.rst b/doc/fluid/api/tensor/math.rst deleted file mode 100644 index 0e0218b03..000000000 --- a/doc/fluid/api/tensor/math.rst +++ /dev/null @@ -1,25 +0,0 @@ -==== -math -==== - -.. toctree:: - :maxdepth: 1 - - math/add.rst - math/addcmul.rst - math/addmm.rst - math/atan.rst - math/clamp.rst - math/div.rst - math/elementwise_sum.rst - math/log1p.rst - math/logsumexp.rst - math/max.rst - math/min.rst - math/mm.rst - math/mul.rst - math/pow.rst - math/sin.rst - math/sqrt.rst - math/sum.rst - math/tanh.rst diff --git a/doc/fluid/api/tensor/math/elementwise_sum.rst b/doc/fluid/api/tensor/math/elementwise_sum.rst deleted file mode 100644 index 05acb3f78..000000000 --- a/doc/fluid/api/tensor/math/elementwise_sum.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_tensor_math_elementwise_sum: - -elementwise_sum ---------------- - -.. autofunction:: paddle.tensor.math.elementwise_sum - :noindex: - diff --git a/doc/fluid/api/tensor/math/mul.rst b/doc/fluid/api/tensor/math/mul.rst deleted file mode 100644 index 9b14559a4..000000000 --- a/doc/fluid/api/tensor/math/mul.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_tensor_math_mul: - -mul ---- - -.. autofunction:: paddle.tensor.math.mul - :noindex: - diff --git a/doc/fluid/api/tensor/math/sin.rst b/doc/fluid/api/tensor/math/sin.rst deleted file mode 100644 index 862334131..000000000 --- a/doc/fluid/api/tensor/math/sin.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_tensor_math_sin: - -sin ---- - -.. autofunction:: paddle.tensor.math.sin - :noindex: - diff --git a/doc/fluid/api/tensor/math/sum.rst b/doc/fluid/api/tensor/math/sum.rst deleted file mode 100644 index 8946b3aa5..000000000 --- a/doc/fluid/api/tensor/math/sum.rst +++ /dev/null @@ -1,11 +0,0 @@ -.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}` - !DO NOT EDIT THIS FILE MANUALLY! - -.. _api_tensor_math_sum: - -sum ---- - -.. autofunction:: paddle.tensor.math.sum - :noindex: - diff --git a/doc/fluid/api/tensor/random.rst b/doc/fluid/api/tensor/random.rst deleted file mode 100644 index 687c6d5af..000000000 --- a/doc/fluid/api/tensor/random.rst +++ /dev/null @@ -1,10 +0,0 @@ -====== -random -====== - -.. toctree:: - :maxdepth: 1 - - random/randint.rst - random/randn.rst - random/randperm.rst diff --git a/doc/fluid/api_cn/dygraph_cn.rst b/doc/fluid/api_cn/dygraph_cn.rst index 09ebf3fa4..2e840f59c 100644 --- a/doc/fluid/api_cn/dygraph_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn.rst @@ -10,6 +10,7 @@ fluid.dygraph dygraph_cn/BackwardStrategy_cn.rst dygraph_cn/BatchNorm_cn.rst + dygraph_cn/BCELoss_cn.rst dygraph_cn/BilinearTensorProduct_cn.rst dygraph_cn/Conv2D_cn.rst dygraph_cn/Conv2DTranspose_cn.rst @@ -17,6 +18,7 @@ fluid.dygraph dygraph_cn/Conv3DTranspose_cn.rst dygraph_cn/CosineDecay_cn.rst dygraph_cn/Dropout_cn.rst + dygraph_cn/declarative_cn.rst dygraph_cn/Embedding_cn.rst dygraph_cn/ExponentialDecay_cn.rst dygraph_cn/FC_cn.rst @@ -24,14 +26,18 @@ fluid.dygraph dygraph_cn/GroupNorm_cn.rst dygraph_cn/GRUUnit_cn.rst dygraph_cn/guard_cn.rst + dygraph_cn/InstanceNorm_cn.rst dygraph_cn/InverseTimeDecay_cn.rst + dygraph_cn/L1Loss_cn.rst dygraph_cn/Layer_cn.rst dygraph_cn/LayerList_cn.rst dygraph_cn/LayerNorm_cn.rst dygraph_cn/Linear_cn.rst dygraph_cn/load_dygraph_cn.rst + dygraph_cn/MSELoss_cn.rst dygraph_cn/NaturalExpDecay_cn.rst dygraph_cn/NCE_cn.rst + dygraph_cn/NLLLoss_cn.rst dygraph_cn/NoamDecay_cn.rst dygraph_cn/ParallelEnv_cn.rst dygraph_cn/ParameterList_cn.rst @@ -41,6 +47,7 @@ fluid.dygraph dygraph_cn/Pool2D_cn.rst dygraph_cn/PRelu_cn.rst dygraph_cn/prepare_context_cn.rst + dygraph_cn/ProgramTranslator_cn.rst dygraph_cn/save_dygraph_cn.rst dygraph_cn/Sequential_cn.rst dygraph_cn/SpectralNorm_cn.rst diff --git a/doc/fluid/api_cn/nn_cn/loss_cn/BCELoss_cn.rst b/doc/fluid/api_cn/dygraph_cn/BCELoss_cn.rst similarity index 100% rename from doc/fluid/api_cn/nn_cn/loss_cn/BCELoss_cn.rst rename to doc/fluid/api_cn/dygraph_cn/BCELoss_cn.rst diff --git a/doc/fluid/api_cn/framework_cn/manual_seed_cn.rst b/doc/fluid/api_cn/dygraph_cn/InstanceNorm_cn.rst similarity index 84% rename from doc/fluid/api_cn/framework_cn/manual_seed_cn.rst rename to doc/fluid/api_cn/dygraph_cn/InstanceNorm_cn.rst index cd11ecaca..15496466d 100644 --- a/doc/fluid/api_cn/framework_cn/manual_seed_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/InstanceNorm_cn.rst @@ -1,3 +1,3 @@ -manual +InstanceNorm ------------------------------- **版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/dygraph_cn/L1Loss_cn.rst b/doc/fluid/api_cn/dygraph_cn/L1Loss_cn.rst new file mode 100644 index 000000000..408ba5887 --- /dev/null +++ b/doc/fluid/api_cn/dygraph_cn/L1Loss_cn.rst @@ -0,0 +1,60 @@ +L1Loss +------------------------------- + +.. py:function:: paddle.fluid.layers.L1Loss(reduction='mean') +该接口用于创建一个L1Loss的可调用类,L1Loss计算输入input和标签label间的 `L1 loss` 损失。 + +该损失函数的数学计算公式如下: + +当 `reduction` 设置为 ``'none'`` 时, + + .. math:: + Out = |input - label| +当 `reduction` 设置为 ``'mean'`` 时, + + .. math:: + Out = MEAN(|input - label|) +当 `reduction` 设置为 ``'sum'`` 时, + + .. math:: + Out = SUM(|input - label|) +输入input和标签label的维度是[N, *], 其中N是batch_size, `*` 是任意其他维度。 +如果 :attr:`reduction` 是 ``'none'``, 则输出Loss的维度为 [N, *], 与输入input相同。 +如果 :attr:`reduction` 是 ``'mean'`` 或 ``'sum'``, 则输出Loss的维度为 [1]。 + +参数: + - **reduction** (string, 可选): - 指定应用于输出结果的计算方式,可选值有: ``'none'``, ``'mean'``, ``'sum'`` 。默认为 ``'mean'``,计算 `L1Loss` 的均值;设置为 ``'sum'`` 时,计算 `L1Loss` 的总和;设置为 ``'none'`` 时,则返回L1Loss。数据类型为string。 + +返回:返回计算L1Loss的可调用对象。 + +**代码示例** + +.. code-block:: python + # declarative mode + import paddle.fluid as fluid + import numpy as np + import paddle + input = fluid.data(name="input", shape=[1]) + label = fluid.data(name="label", shape=[1]) + l1_loss = fluid.layers.L1Loss(reduction='mean') + output = l1_loss(input,label) + place = fluid.CPUPlace() + exe = fluid.Executor(place) + exe.run(fluid.default_startup_program()) + input_data = np.array([1.5]).astype("float32") + label_data = np.array([1.7]).astype("float32") + output_data = exe.run(fluid.default_main_program(), + feed={"input":input_data, "label":label_data}, + fetch_list=[output], + return_numpy=True) + print(output_data) # [array([0.2], dtype=float32)] + + # imperative mode + import paddle.fluid.dygraph as dg + with dg.guard(place) as g: + input = dg.to_variable(input_data) + label = dg.to_variable(label_data) + l1_loss = fluid.layers.L1Loss(reduction='mean') + output = l1_loss(input,label) + print(output.numpy()) # [0.2] + diff --git a/doc/fluid/api_cn/nn_cn/loss_cn/MSELoss_cn.rst b/doc/fluid/api_cn/dygraph_cn/MSELoss_cn.rst similarity index 100% rename from doc/fluid/api_cn/nn_cn/loss_cn/MSELoss_cn.rst rename to doc/fluid/api_cn/dygraph_cn/MSELoss_cn.rst diff --git a/doc/fluid/api_cn/dygraph_cn/NLLLoss_cn.rst b/doc/fluid/api_cn/dygraph_cn/NLLLoss_cn.rst index 9b42b49d3..1436eeb08 100644 --- a/doc/fluid/api_cn/dygraph_cn/NLLLoss_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/NLLLoss_cn.rst @@ -1,75 +1,3 @@ NLLLoss ------------------------------- - -.. py:function:: paddle.fluid.dygraph.NLLLoss(weight=None, reduction='mean', ignore_index=-100) - -该OP计算输入input和标签label间的 `negative log likelihood loss` 损失 ,可用于训练一个 `n` 类分类器。 - -如果提供 `weight` 参数的话,它是一个 `1-D` 的tensor, 里面的值对应类别的权重。当你的训练集样本 -不均衡的话,使用这个参数是非常有用的。 - -该损失函数的数学计算公式如下: - -当 `reduction` 设置为 `none` 时,损失函数的数学计算公式为: - - .. math:: - \ell(x, y) = L = \{l_1,\dots,l_N\}^\top, \quad - l_n = - w_{y_n} x_{n,y_n}, \quad - w_{c} = \text{weight}[c] \cdot \mathbb{1}\{c \not= \text{ignore_index}\}, - -其中 `N` 表示 `batch_size` 。如果 `reduction` 的值不是 `none` (默认为 `mean`),那么此时损失函数 -的数学计算公式为: - - .. math:: - \ell(x, y) = \begin{cases} - \sum_{n=1}^N \frac{1}{\sum_{n=1}^N w_{y_n}} l_n, & - \text{if reduction} = \text{'mean';}\\ - \sum_{n=1}^N l_n, & - \text{if reduction} = \text{'sum'.} - \end{cases} - -参数: - - **input** (Variable): - 输入 `Tensor`, 其形状为 :math:`[N, C]` , 其中 `C` 为类别数。但是对于多维度的情形下,它的形状为 :math:`[N, C, d_1, d_2, ..., d_K]` 。数据类型为float32或float64。 - - **label** (Variable): - 输入input对应的标签值。其形状为 :math:`[N,]` 或者 :math:`[N, d_1, d_2, ..., d_K]`, 数据类型为int64。 - - **weight** (Variable, 可选): - 手动指定每个类别的权重。其默认为 `None` 。如果提供该参数的话,长度必须为 `num_classes` 。数据类型为float32或float64。 - - **reduction** (string, 可选): - 指定应用于输出结果的计算方式,可选值有: `none`, `mean`, `sum` 。默认为 `mean` ,计算 `mini-batch` loss均值。设置为 `sum` 时,计算 `mini-batch` loss的总和。设置为 `none` 时,则返回loss Tensor。数据类型为string。 - - **ignore_index** (int64, 可选): - 指定一个忽略的标签值,此标签值不参与计算。默认值为-100。数据类型为int64。 - -返回:返回存储表示 `negative log likihood loss` 的损失值。 - -返回类型:Variable - -**代码示例** - -.. code-block:: python - - # declarative mode - import paddle.fluid as fluid - import numpy as np - import paddle - input_np = np.random.random(size=(10, 10)).astype(np.float32) - label_np = np.random.randint(0, 10, size=(10,)).astype(np.int64) - prog = fluid.Program() - startup_prog = fluid.Program() - place = fluid.CPUPlace() - with fluid.program_guard(prog, startup_prog): - input = fluid.data(name='input', shape=[10, 10], dtype='float32') - label = fluid.data(name='label', shape=[10], dtype='int64') - nll_loss = fluid.dygraph.NLLLoss() - res = nll_loss(input, label) - exe = fluid.Executor(place) - static_result = exe.run( - prog, - feed={"input": input_np, - "label": label_np}, - fetch_list=[res]) - print(static_result) - - # imperative mode - import paddle.fluid.dygraph as dg - with dg.guard(place) as g: - input = dg.to_variable(input_np) - label = dg.to_variable(label_np) - output = nll_loss(input, label) - print(output.numpy()) - +**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/Conv1D_cn.rst b/doc/fluid/api_cn/dygraph_cn/ProgramTranslator_cn.rst similarity index 80% rename from doc/fluid/api_cn/nn_cn/Conv1D_cn.rst rename to doc/fluid/api_cn/dygraph_cn/ProgramTranslator_cn.rst index c42733353..3b6eae361 100644 --- a/doc/fluid/api_cn/nn_cn/Conv1D_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/ProgramTranslator_cn.rst @@ -1,3 +1,3 @@ -Conv1D +ProgramTranslator ------------------------------- **版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/framework_cn/get_default_dtype_cn.rst b/doc/fluid/api_cn/dygraph_cn/declarative_cn.txt similarity index 85% rename from doc/fluid/api_cn/framework_cn/get_default_dtype_cn.rst rename to doc/fluid/api_cn/dygraph_cn/declarative_cn.txt index 2a3de9256..44a8e4b93 100644 --- a/doc/fluid/api_cn/framework_cn/get_default_dtype_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/declarative_cn.txt @@ -1,3 +1,3 @@ -get +declarative ------------------------------- **版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/framework_cn.rst b/doc/fluid/api_cn/framework_cn.rst deleted file mode 100644 index 71126981a..000000000 --- a/doc/fluid/api_cn/framework_cn.rst +++ /dev/null @@ -1,13 +0,0 @@ -======================= -paddle.framework -======================= - - - - -.. toctree:: - :maxdepth: 1 - - framework_cn/get_default_dtype_cn.rst - framework_cn/manual_seed_cn.rst - framework_cn/set_default_dtype_cn.rst diff --git a/doc/fluid/api_cn/index_cn.rst b/doc/fluid/api_cn/index_cn.rst index f13a42320..8599fb58c 100644 --- a/doc/fluid/api_cn/index_cn.rst +++ b/doc/fluid/api_cn/index_cn.rst @@ -6,9 +6,6 @@ API Reference :maxdepth: 1 ../api_guides/index_cn.rst - framework_cn.rst - nn_cn.rst - tensor_cn.rst fluid_cn.rst api_tree_cn.rst backward_cn.rst @@ -24,6 +21,5 @@ API Reference optimizer_cn.rst profiler_cn.rst regularizer_cn.rst - tensor_cn.rst transpiler_cn.rst unique_name_cn.rst diff --git a/doc/fluid/api_cn/layers_cn.rst b/doc/fluid/api_cn/layers_cn.rst index dd94cfc41..05188d092 100644 --- a/doc/fluid/api_cn/layers_cn.rst +++ b/doc/fluid/api_cn/layers_cn.rst @@ -16,9 +16,13 @@ fluid.layers layers_cn/adaptive_pool2d_cn.rst layers_cn/adaptive_pool3d_cn.rst layers_cn/add_position_encoding_cn.rst + layers_cn/addcmul_cn.rst + layers_cn/addmm_cn.rst layers_cn/affine_channel_cn.rst layers_cn/affine_grid_cn.rst + layers_cn/allclose_cn.rst layers_cn/anchor_generator_cn.rst + layers_cn/arange_cn.rst layers_cn/argmax_cn.rst layers_cn/argmin_cn.rst layers_cn/argsort_cn.rst @@ -35,6 +39,7 @@ fluid.layers layers_cn/beam_search_decode_cn.rst layers_cn/bilinear_tensor_product_cn.rst layers_cn/bipartite_match_cn.rst + layers_cn/bmm_cn.rst layers_cn/box_clip_cn.rst layers_cn/box_coder_cn.rst layers_cn/box_decoder_and_assign_cn.rst @@ -47,6 +52,7 @@ fluid.layers layers_cn/ceil_cn.rst layers_cn/center_loss_cn.rst layers_cn/chunk_eval_cn.rst + layers_cn/clamp_cn.rst layers_cn/clip_by_norm_cn.rst layers_cn/clip_cn.rst layers_cn/collect_fpn_proposals_cn.rst @@ -68,6 +74,7 @@ fluid.layers layers_cn/crf_decoding_cn.rst layers_cn/crop_cn.rst layers_cn/crop_tensor_cn.rst + layers_cn/cross_cn.rst layers_cn/cross_entropy_cn.rst layers_cn/ctc_greedy_decoder_cn.rst layers_cn/cumsum_cn.rst @@ -78,8 +85,11 @@ fluid.layers layers_cn/density_prior_box_cn.rst layers_cn/detection_output_cn.rst layers_cn/diag_cn.rst + layers_cn/diag_embed_cn.rst layers_cn/dice_loss_cn.rst + layers_cn/dist_cn.rst layers_cn/distribute_fpn_proposals_cn.rst + layers_cn/dot_cn.rst layers_cn/double_buffer_cn.rst layers_cn/dropout_cn.rst layers_cn/dynamic_gru_cn.rst @@ -91,6 +101,7 @@ fluid.layers layers_cn/edit_distance_cn.rst layers_cn/elementwise_add_cn.rst layers_cn/elementwise_div_cn.rst + layers_cn/elementwise_equal_cn.rst layers_cn/elementwise_floordiv_cn.rst layers_cn/elementwise_max_cn.rst layers_cn/elementwise_min_cn.rst @@ -111,8 +122,11 @@ fluid.layers layers_cn/fill_constant_cn.rst layers_cn/filter_by_instag_cn.rst layers_cn/flatten_cn.rst + layers_cn/flip_cn.rst layers_cn/floor_cn.rst layers_cn/fsp_matrix_cn.rst + layers_cn/full_cn.rst + layers_cn/full_like_cn.rst layers_cn/gather_cn.rst layers_cn/gather_nd_cn.rst layers_cn/gather_tree_cn.rst @@ -142,11 +156,14 @@ fluid.layers layers_cn/image_resize_short_cn.rst layers_cn/increment_cn.rst layers_cn/inverse_time_decay_cn.rst + layers_cn/index_select_cn.rst layers_cn/instance_norm_cn.rst + layers_cn/interpolate_cn.rst layers_cn/iou_similarity_cn.rst layers_cn/is_empty_cn.rst layers_cn/isfinite_cn.rst layers_cn/kldiv_loss_cn.rst + layers_cn/kron_cn.rst layers_cn/l2_normalize_cn.rst layers_cn/label_smooth_cn.rst layers_cn/layer_norm_cn.rst @@ -160,12 +177,15 @@ fluid.layers layers_cn/lod_append_cn.rst layers_cn/lod_reset_cn.rst layers_cn/log_cn.rst + layers_cn/log1p_cn.rst layers_cn/log_loss_cn.rst + layers_cn/log_softmax_cn.rst layers_cn/logical_and_cn.rst layers_cn/logical_not_cn.rst layers_cn/logical_or_cn.rst layers_cn/logical_xor_cn.rst layers_cn/logsigmoid_cn.rst + layers_cn/logsumexp_cn.rst layers_cn/lrn_cn.rst layers_cn/lstm_cn.rst layers_cn/lstm_unit_cn.rst @@ -177,6 +197,7 @@ fluid.layers layers_cn/mean_cn.rst layers_cn/mean_iou_cn.rst layers_cn/merge_selected_rows_cn.rst + layers_cn/meshgrid_cn.rst layers_cn/mse_loss_cn.rst layers_cn/mul_cn.rst layers_cn/multi_box_head_cn.rst @@ -186,6 +207,7 @@ fluid.layers layers_cn/natural_exp_decay_cn.rst layers_cn/nce_cn.rst layers_cn/noam_decay_cn.rst + layers_cn/nonzero_cn.rst layers_cn/Normal_cn.rst layers_cn/not_equal_cn.rst layers_cn/npair_loss_cn.rst @@ -210,8 +232,10 @@ fluid.layers layers_cn/py_func_cn.rst layers_cn/py_reader_cn.rst layers_cn/randint_cn.rst + layers_cn/randn_cn.rst layers_cn/random_crop_cn.rst layers_cn/range_cn.rst + layers_cn/randperm_cn.rst layers_cn/rank_cn.rst layers_cn/rank_loss_cn.rst layers_cn/read_file_cn.rst @@ -237,6 +261,7 @@ fluid.layers layers_cn/roi_align_cn.rst layers_cn/roi_perspective_transform_cn.rst layers_cn/roi_pool_cn.rst + layers_cn/roll_cn.rst layers_cn/round_cn.rst layers_cn/row_conv_cn.rst layers_cn/rpn_target_assign_cn.rst @@ -300,6 +325,7 @@ fluid.layers layers_cn/swish_cn.rst layers_cn/Switch_cn.rst layers_cn/switch_case_cn.rst + layers_cn/t_cn.rst layers_cn/tanh_cn.rst layers_cn/tanh_shrink_cn.rst layers_cn/target_assign_cn.rst @@ -308,7 +334,10 @@ fluid.layers layers_cn/tensor_array_to_tensor_cn.rst layers_cn/thresholded_relu_cn.rst layers_cn/topk_cn.rst + layers_cn/trace_cn.rst layers_cn/transpose_cn.rst + layers_cn/tril_cn.rst + layers_cn/triu_cn.rst layers_cn/unfold_cn.rst layers_cn/Uniform_cn.rst layers_cn/uniform_random_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/addcmul_cn.rst b/doc/fluid/api_cn/layers_cn/addcmul_cn.rst similarity index 90% rename from doc/fluid/api_cn/tensor_cn/addcmul_cn.rst rename to doc/fluid/api_cn/layers_cn/addcmul_cn.rst index 5c03e1e13..a985221e9 100644 --- a/doc/fluid/api_cn/tensor_cn/addcmul_cn.rst +++ b/doc/fluid/api_cn/layers_cn/addcmul_cn.rst @@ -3,7 +3,7 @@ addcmul ------------------------------- -.. py:function:: paddle.addcmul(input, tensor1, tensor2, value=1.0, out=None, name=None) +.. py:function:: paddle.fluid.layers.addcmul(input, tensor1, tensor2, value=1.0, out=None, name=None) 计算tensor1和tensor2的逐元素乘积,然后将结果乘以标量value,再加到input上输出。其中input, tensor1, tensor2的维度必须是可广播的。 @@ -33,5 +33,5 @@ addcmul input = fluid.data(name='input', dtype='float32', shape=[3, 4]) tensor1 = fluid.data(name='tenosr1', dtype='float32', shape=[1, 4]) tensor2 = fluid.data(name='tensor2', dtype='float32', shape=[3, 4]) - data = paddle.addcmul(input, tensor1, tensor2, value=1.0) + data = fluid.layers.addcmul(input, tensor1, tensor2, value=1.0) diff --git a/doc/fluid/api_cn/tensor_cn/addmm_cn.rst b/doc/fluid/api_cn/layers_cn/addmm_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/addmm_cn.rst rename to doc/fluid/api_cn/layers_cn/addmm_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/allclose_cn.rst b/doc/fluid/api_cn/layers_cn/allclose_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/allclose_cn.rst rename to doc/fluid/api_cn/layers_cn/allclose_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/arange_cn.rst b/doc/fluid/api_cn/layers_cn/arange_cn.rst similarity index 88% rename from doc/fluid/api_cn/tensor_cn/arange_cn.rst rename to doc/fluid/api_cn/layers_cn/arange_cn.rst index e79a1fa74..660923973 100644 --- a/doc/fluid/api_cn/tensor_cn/arange_cn.rst +++ b/doc/fluid/api_cn/layers_cn/arange_cn.rst @@ -3,7 +3,7 @@ arange ------------------------------- -.. py:function:: paddle.tensor.arange(start, end, step=1, dtype=None, name=None) +.. py:function:: paddle.fluid.layers.arange(start, end, step=1, dtype=None, name=None) 该API根据step均匀分隔给定数值区间[start, end),并返回该分隔结果。 @@ -24,6 +24,6 @@ arange import paddle import paddle.fluid as fluid with fluid.dygraph.guard(): - x = paddle.arange(0, 6, 2) + x = fluid.layers.arange(0, 6, 2) # x: [0, 2, 4] # x dtype: float32 diff --git a/doc/fluid/api_cn/tensor_cn/bmm_cn.rst b/doc/fluid/api_cn/layers_cn/bmm_cn.rst similarity index 93% rename from doc/fluid/api_cn/tensor_cn/bmm_cn.rst rename to doc/fluid/api_cn/layers_cn/bmm_cn.rst index 330d70956..c6fbf50a1 100644 --- a/doc/fluid/api_cn/tensor_cn/bmm_cn.rst +++ b/doc/fluid/api_cn/layers_cn/bmm_cn.rst @@ -3,7 +3,7 @@ bmm ------------------------------- -.. py:function:: paddle.tensor.bmm(x, y, name=None): +.. py:function:: paddle.fluid.layers.bmm(x, y, name=None): 对输入x及输入y进行矩阵相乘。 @@ -38,7 +38,7 @@ bmm with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(input1) y = fluid.dygraph.to_variable(input2) - out = paddle.bmm(x, y) + out = fluid.layers.bmm(x, y) #output size: (2, 2, 2) #output value: #[[[6.0, 6.0],[12.0, 12.0]],[[45.0, 45.0],[60.0, 60.0]]] diff --git a/doc/fluid/api_cn/tensor_cn/clamp_cn.rst b/doc/fluid/api_cn/layers_cn/clamp_cn.rst similarity index 89% rename from doc/fluid/api_cn/tensor_cn/clamp_cn.rst rename to doc/fluid/api_cn/layers_cn/clamp_cn.rst index 066fb3869..8a2c42cdb 100644 --- a/doc/fluid/api_cn/tensor_cn/clamp_cn.rst +++ b/doc/fluid/api_cn/layers_cn/clamp_cn.rst @@ -3,7 +3,7 @@ clamp ------------------------------- -.. py:function:: paddle.clamp(input, min=None, max=None, output=None, name=None) +.. py:function:: paddle.fluid.layers.clamp(input, min=None, max=None, output=None, name=None) 该OP将输入的所有元素进行剪裁,使得输出元素限制在[min, max]内,具体公式如下: @@ -34,8 +34,8 @@ clamp [4.5,6.4]]).astype('float32') with fluid.dygraph.guard(): x1 = fluid.dygraph.to_variable(in1) - out1 = paddle.tensor.clamp(x1, min=3.5, max=5.0) - out2 = paddle.tensor.clamp(x1, min=2.5) + out1 = fluid.layers.clamp(x1, min=3.5, max=5.0) + out2 = fluid.layers.clamp(x1, min=2.5) print(out1.numpy()) # [[3.5, 3.5] # [4.5, 5.0]] diff --git a/doc/fluid/api_cn/tensor_cn/cross_cn.rst b/doc/fluid/api_cn/layers_cn/cross_cn.rst similarity index 89% rename from doc/fluid/api_cn/tensor_cn/cross_cn.rst rename to doc/fluid/api_cn/layers_cn/cross_cn.rst index f8e4d6771..b2786c32b 100644 --- a/doc/fluid/api_cn/tensor_cn/cross_cn.rst +++ b/doc/fluid/api_cn/layers_cn/cross_cn.rst @@ -3,7 +3,7 @@ cross ------------------------------- -.. py:function:: paddle.cross(input, other, dim=None) +.. py:function:: paddle.fluid.layers.cross(input, other, dim=None) 该OP返回在 ``dim`` 维度上,两个张量 ``input`` 和 ``other`` 的向量积(叉积)。 ``input`` 和 ``other`` 必须有相同的形状, 且指定的 ``dim`` 维上 ``size`` 必须为3,如果 ``dim`` 未指定,默认选取第一个 ``size`` 等于3的维度。 @@ -34,12 +34,12 @@ cross with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(data_x) y = fluid.dygraph.to_variable(data_y) - out_z1 = paddle.cross(x, y) + out_z1 = fluid.layers.cross(x, y) print(out_z1.numpy()) #[[-1. -1. -1.] # [ 2. 2. 2.] # [-1. -1. -1.]] - out_z2 = paddle.cross(x, y, dim=1) + out_z2 = fluid.layers.cross(x, y, dim=1) print(out_z2.numpy()) #[[0. 0. 0.] # [0. 0. 0.] diff --git a/doc/fluid/api_cn/nn_cn/diag_embed_cn.rst b/doc/fluid/api_cn/layers_cn/diag_embed_cn.rst similarity index 100% rename from doc/fluid/api_cn/nn_cn/diag_embed_cn.rst rename to doc/fluid/api_cn/layers_cn/diag_embed_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/dist_cn.rst b/doc/fluid/api_cn/layers_cn/dist_cn.rst similarity index 91% rename from doc/fluid/api_cn/tensor_cn/dist_cn.rst rename to doc/fluid/api_cn/layers_cn/dist_cn.rst index 1b4bb827f..fbf5f5d08 100644 --- a/doc/fluid/api_cn/tensor_cn/dist_cn.rst +++ b/doc/fluid/api_cn/layers_cn/dist_cn.rst @@ -3,7 +3,7 @@ dist ------------------------------- -.. py:function:: paddle.tensor.linalg.dist(x, y, p=2) +.. py:function:: paddle.fluid.layers.linalg.dist(x, y, p=2) 该OP用于计算 `(x-y)` 的 p 范数(p-norm),需要注意这不是严格意义上的范数,仅作为距离的度量。输入 `x` 和 `y` 的形状(shape)必须是可广播的(broadcastable)。其含义如下,详情请参考 `numpy的广播概念 `_ : @@ -65,11 +65,11 @@ z (4-D Tensor): 8 x 7 x 6 x 5 with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(np.array([[3, 3],[3, 3]]).astype(np.float32)) y = fluid.dygraph.to_variable(np.array([[3, 3],[3, 1]]).astype(np.float32)) - out = paddle.dist(x, y, 0) + out = fluid.layers.dist(x, y, 0) print(out.numpy()) # out = [1.] - out = paddle.dist(x, y, 2) + out = fluid.layers.dist(x, y, 2) print(out.numpy()) # out = [2.] - out = paddle.dist(x, y, float("inf")) + out = fluid.layers.dist(x, y, float("inf")) print(out.numpy()) # out = [2.] - out = paddle.dist(x, y, float("-inf")) + out = fluid.layers.dist(x, y, float("-inf")) print(out.numpy()) # out = [0.] diff --git a/doc/fluid/api_cn/tensor_cn/dot_cn.rst b/doc/fluid/api_cn/layers_cn/dot_cn.rst similarity index 92% rename from doc/fluid/api_cn/tensor_cn/dot_cn.rst rename to doc/fluid/api_cn/layers_cn/dot_cn.rst index 37c5e3a21..f2f01acb7 100644 --- a/doc/fluid/api_cn/tensor_cn/dot_cn.rst +++ b/doc/fluid/api_cn/layers_cn/dot_cn.rst @@ -3,7 +3,7 @@ dot ------------------------------- -.. py:function:: paddle.tensor.linalg.dot(x, y, name=None) +.. py:function:: paddle.fluid.layers.dot(x, y, name=None) 该OP计算向量的内积 @@ -31,7 +31,7 @@ dot with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(np.random.uniform(0.1, 1, [10]).astype(np.float32)) y = fluid.dygraph.to_variable(np.random.uniform(1, 3, [10]).astype(np.float32)) - z = paddle.dot(x, y) + z = fluid.layers.dot(x, y) print(z.numpy()) diff --git a/doc/fluid/api_cn/tensor_cn/elementwise_equal_cn.rst b/doc/fluid/api_cn/layers_cn/elementwise_equal_cn.rst similarity index 85% rename from doc/fluid/api_cn/tensor_cn/elementwise_equal_cn.rst rename to doc/fluid/api_cn/layers_cn/elementwise_equal_cn.rst index 5c45f7415..d7228e76b 100644 --- a/doc/fluid/api_cn/tensor_cn/elementwise_equal_cn.rst +++ b/doc/fluid/api_cn/layers_cn/elementwise_equal_cn.rst @@ -3,7 +3,7 @@ elementwise_equal ------------------------------- -.. py:function:: paddle.elementwise_equal(x, y, name=None) +.. py:function:: paddle.fluid.layers.elementwise_equal(x, y, name=None) 该OP返回 :math:`x==y` 逐元素比较x和y是否相等。 @@ -26,4 +26,4 @@ elementwise_equal label = fluid.layers.assign(np.array([3, 3], dtype="int32")) limit = fluid.layers.assign(np.array([3, 2], dtype="int32")) - out1 = paddle.elementwise_equal(x=label, y=limit) #out1=[True, False] + out1 = fluid.layers.elementwise_equal(x=label, y=limit) #out1=[True, False] diff --git a/doc/fluid/api_cn/tensor_cn/flip_cn.rst b/doc/fluid/api_cn/layers_cn/flip_cn.rst similarity index 93% rename from doc/fluid/api_cn/tensor_cn/flip_cn.rst rename to doc/fluid/api_cn/layers_cn/flip_cn.rst index 0d16bc7d6..bbaf71640 100644 --- a/doc/fluid/api_cn/tensor_cn/flip_cn.rst +++ b/doc/fluid/api_cn/layers_cn/flip_cn.rst @@ -3,7 +3,7 @@ flip ------------------------------- -.. py:function:: paddle.flip(input, dims, name=None): +.. py:function:: paddle.fluid.layers.flip(input, dims, name=None): 该OP沿指定轴反转n维tensor. @@ -45,6 +45,6 @@ flip img = np.arange(12).reshape((3,2,2)).astype(np.float32) with fluid.dygraph.guard(): inputs = fluid.dygraph.to_variable(img) - ret = paddle.flip(inputs, [0, 1]) + ret = fluid.layers.flip(inputs, [0, 1]) print(ret.numpy()) # [[[10,11][8, 9]],[[6, 7],[4, 5]] [[2, 3],[0, 1]]] diff --git a/doc/fluid/api_cn/tensor_cn/full_cn.rst b/doc/fluid/api_cn/layers_cn/full_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/full_cn.rst rename to doc/fluid/api_cn/layers_cn/full_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/full_like_cn.rst b/doc/fluid/api_cn/layers_cn/full_like_cn.rst similarity index 91% rename from doc/fluid/api_cn/tensor_cn/full_like_cn.rst rename to doc/fluid/api_cn/layers_cn/full_like_cn.rst index 2fb1309fd..0d02b9b74 100644 --- a/doc/fluid/api_cn/tensor_cn/full_like_cn.rst +++ b/doc/fluid/api_cn/layers_cn/full_like_cn.rst @@ -3,7 +3,7 @@ full_like ------------------------------- -.. py:function:: paddle.full_like(input, fill_value, out=None, dtype=None, device=None, stop_gradient=True, name=None) +.. py:function:: paddle.fluid.layers.full_like(input, fill_value, out=None, dtype=None, device=None, stop_gradient=True, name=None) 该OP创建一个和input具有相同的形状和数据类型的Tensor,其中元素值均为fill_value。 @@ -28,7 +28,7 @@ full_like import paddle.fluid as fluid import numpy as np input = fluid.data(name='input', dtype='float32', shape=[2, 3]) - output = paddle.full_like(input, 2.0) + output = fluid.layers..full_like(input, 2.0) exe = fluid.Executor(fluid.CPUPlace()) exe.run(fluid.default_startup_program()) img=np.array([[1, 2, 3], [4, 5, 6]]).astype(np.float32) diff --git a/doc/fluid/api_cn/tensor_cn/index_select_cn.rst b/doc/fluid/api_cn/layers_cn/index_select_cn.rst similarity index 88% rename from doc/fluid/api_cn/tensor_cn/index_select_cn.rst rename to doc/fluid/api_cn/layers_cn/index_select_cn.rst index 61883ac08..1b581b6e4 100644 --- a/doc/fluid/api_cn/tensor_cn/index_select_cn.rst +++ b/doc/fluid/api_cn/layers_cn/index_select_cn.rst @@ -3,7 +3,7 @@ index_select ------------------------------- -.. py:function:: paddle.index_select(input, index, dim=0) +.. py:function:: paddle.fluid.layers.index_select(input, index, dim=0) 该OP沿着指定维度 ``dim`` 对输入 ``input`` 进行索引,取 ``index`` 中指定的相应项,然后返回到一个新的张量。这里 ``index`` 是一个 ``1-D`` 张量。除 ``dim`` 维外,返回的张量其余维度大小同输入 ``input`` , ``dim`` 维大小等于 ``index`` 的大小。 @@ -31,12 +31,12 @@ index_select with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(data) index = fluid.dygraph.to_variable(data_index) - out_z1 = paddle.index_select(x, index) + out_z1 = fluid.layers.index_select(x, index) print(out_z1.numpy()) #[[1. 2. 3. 4.] # [5. 6. 7. 8.] # [5. 6. 7. 8.]] - out_z2 = paddle.index_select(x, index, dim=1) + out_z2 = fluid.layers.index_select(x, index, dim=1) print(out_z2.numpy()) #[[ 1. 2. 2.] # [ 5. 6. 6.] diff --git a/doc/fluid/api_cn/nn_cn/interpolate_cn.rst b/doc/fluid/api_cn/layers_cn/interpolate_cn.rst similarity index 100% rename from doc/fluid/api_cn/nn_cn/interpolate_cn.rst rename to doc/fluid/api_cn/layers_cn/interpolate_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/kron_cn.rst b/doc/fluid/api_cn/layers_cn/kron_cn.rst similarity index 95% rename from doc/fluid/api_cn/tensor_cn/kron_cn.rst rename to doc/fluid/api_cn/layers_cn/kron_cn.rst index 375bb4804..fb5129e2d 100644 --- a/doc/fluid/api_cn/tensor_cn/kron_cn.rst +++ b/doc/fluid/api_cn/layers_cn/kron_cn.rst @@ -3,7 +3,7 @@ kron ------------------------------- -.. py:function:: paddle.tensor.kron(x, y, out=None, name=None) +.. py:function:: paddle.fluid.layers.kron(x, y, out=None, name=None) Kronecker Product 算子。 @@ -61,7 +61,7 @@ Kronecker Product 算子。 with dg.guard(place): a_var = dg.to_variable(a) b_var = dg.to_variable(b) - c_var = paddle.kron(a_var, b_var) + c_var = fluid.layers.kron(a_var, b_var) c_np = c_var.numpy() print(c_np) diff --git a/doc/fluid/api_cn/tensor_cn/log1p_cn.rst b/doc/fluid/api_cn/layers_cn/log1p_cn.rst similarity index 90% rename from doc/fluid/api_cn/tensor_cn/log1p_cn.rst rename to doc/fluid/api_cn/layers_cn/log1p_cn.rst index 32be102c8..282c3d018 100644 --- a/doc/fluid/api_cn/tensor_cn/log1p_cn.rst +++ b/doc/fluid/api_cn/layers_cn/log1p_cn.rst @@ -3,7 +3,7 @@ log1p ------------------------------- -.. py:function:: paddle.tensor.log1p(x, out=None, name=None) +.. py:function:: paddle.fluid.layers.log1p(x, out=None, name=None) 该OP计算Log1p(加一的自然对数)结果。 @@ -31,7 +31,7 @@ log1p import numpy as np x = fluid.data(name="x", shape=[2,1], dtype="float32") - res = paddle.log1p(x) # paddle.log1p等价于 paddle.tensor.log1p + res = fluid.layers.log1p(x) # 举例选择CPU计算环境 exe = fluid.Executor(fluid.CPUPlace()) diff --git a/doc/fluid/api_cn/nn_cn/log_softmax_cn.rst b/doc/fluid/api_cn/layers_cn/log_softmax_cn.rst similarity index 100% rename from doc/fluid/api_cn/nn_cn/log_softmax_cn.rst rename to doc/fluid/api_cn/layers_cn/log_softmax_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/logsumexp_cn.rst b/doc/fluid/api_cn/layers_cn/logsumexp_cn.rst similarity index 86% rename from doc/fluid/api_cn/tensor_cn/logsumexp_cn.rst rename to doc/fluid/api_cn/layers_cn/logsumexp_cn.rst index 2ee70212e..83d65a08f 100644 --- a/doc/fluid/api_cn/tensor_cn/logsumexp_cn.rst +++ b/doc/fluid/api_cn/layers_cn/logsumexp_cn.rst @@ -3,7 +3,7 @@ logsumexp ------------------------------- -.. py:function:: paddle.tensor.math.logsumexp(x, dim=None, keepdim=False, out=None, name=None) +.. py:function:: paddle.fluid.layers.logsumexp(x, dim=None, keepdim=False, out=None, name=None) 该OP对输入Tensor的元素以e为底做指数运算,然后根据指定维度做求和之后取自然对数 @@ -32,7 +32,7 @@ logsumexp with fluid.dygraph.guard(): np_x = np.random.uniform(0.1, 1, [10]).astype(np.float32) x = fluid.dygraph.to_variable(np_x) - print(paddle.logsumexp(x).numpy()) + print(fluid.layers.logsumexp(x).numpy()) **代码示例2** @@ -45,5 +45,5 @@ logsumexp with fluid.dygraph.guard(): np_x = np.random.uniform(0.1, 1, [2, 3, 4]).astype(np.float32) x = fluid.dygraph.to_variable(np_x) - print(paddle.logsumexp(x, dim=1).numpy()) - print(paddle.logsumexp(x, dim=[0, 2]).numpy()) + print(fluid.layers.logsumexp(x, dim=1).numpy()) + print(fluid.layers.logsumexp(x, dim=[0, 2]).numpy()) diff --git a/doc/fluid/api_cn/tensor_cn/meshgrid_cn.rst b/doc/fluid/api_cn/layers_cn/meshgrid_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/meshgrid_cn.rst rename to doc/fluid/api_cn/layers_cn/meshgrid_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/nonzero_cn.rst b/doc/fluid/api_cn/layers_cn/nonzero_cn.rst similarity index 83% rename from doc/fluid/api_cn/tensor_cn/nonzero_cn.rst rename to doc/fluid/api_cn/layers_cn/nonzero_cn.rst index 8a4be36cd..27c5ec992 100644 --- a/doc/fluid/api_cn/tensor_cn/nonzero_cn.rst +++ b/doc/fluid/api_cn/layers_cn/nonzero_cn.rst @@ -3,7 +3,7 @@ nonzero ------------------------------- -.. py:function:: paddle.nonzero(input, as_tuple=False) +.. py:function:: paddle.fluid.layers.nonzero(input, as_tuple=False) 该OP返回输入 ``input`` 中非零元素的坐标。如果输入 ``input`` 有 ``n`` 维,共包含 ``z`` 个非零元素,当 ``as_tuple = False`` 时, 返回结果是一个 ``shape`` 等于 ``[z x n]`` 的 ``Tensor`` , 第 ``i`` 行代表输入中第 ``i`` 个非零元素的坐标;当 ``as_tuple = True`` 时, @@ -33,12 +33,12 @@ nonzero x1 = fluid.dygraph.to_variable(data1) x2 = fluid.dygraph.to_variable(data2) x3 = fluid.dygraph.to_variable(data3) - out_z1 = paddle.nonzero(x1) + out_z1 = fluid.layers.nonzero(x1) print(out_z1.numpy()) #[[0 0] # [1 1] # [2 2]] - out_z1_tuple = paddle.nonzero(x1, as_tuple=True) + out_z1_tuple = fluid.layers.nonzero(x1, as_tuple=True) for out in out_z1_tuple: print(out.numpy()) #[[0] @@ -47,19 +47,19 @@ nonzero #[[0] # [1] # [2]] - out_z2 = paddle.nonzero(x2) + out_z2 = fluid.layers.nonzero(x2) print(out_z2.numpy()) #[[1] # [3]] - out_z2_tuple = paddle.nonzero(x2, as_tuple=True) + out_z2_tuple = fluid.layers.nonzero(x2, as_tuple=True) for out in out_z2_tuple: print(out.numpy()) #[[1] # [3]] - out_z3 = paddle.nonzero(x3) + out_z3 = fluid.layers.nonzero(x3) print(out_z3.numpy()) #[] - out_z3_tuple = paddle.nonzero(x3, as_tuple=True) + out_z3_tuple = fluid.layers.nonzero(x3, as_tuple=True) for out in out_z3_tuple: print(out.numpy()) #[] diff --git a/doc/fluid/api_cn/layers_cn/randint_cn.rst b/doc/fluid/api_cn/layers_cn/randint_cn.rst index 49460b063..c12490bfd 100644 --- a/doc/fluid/api_cn/layers_cn/randint_cn.rst +++ b/doc/fluid/api_cn/layers_cn/randint_cn.rst @@ -1,56 +1,3 @@ -.. _cn_api_fluid_layers_randint: - randint ------------------------------- - -.. py:function:: paddle.fluid.layers.randint(low, high=None, shape=None, out=None, dtype=None, device=None, stop_gradient=False, seed=0, name=None) - -该OP使用从区间[low,high)内均匀分布采样的随机整数初始化一个Tensor。当high为None时(默认),均匀采样的区间为[0,low)。 - -参数: - - **low** (int)-要生成的随机值范围的下限,low包含在范围中。当high为None时,均匀采样的区间为[0,low)。 - - **high** (int,可选)-要生成的随机值范围的上限,high不包含在范围中。默认值为None。 - - **shape** (list|tuple|Variable,可选)-输出Tensor的维度,shape类型支持list,tuple,Variable。如果shape类型是list或者tuple,它的元素可以是整数或者形状为[1]的Tensor,其中整数的数据类型为int,Tensor的数据类型为int32或int64。如果shape的类型是Variable,则是1D的Tensor,Tensor的数据类型为int32或int64。如果shape为None,则会将shape设置为[1]。默认值为None。 - - **out** (Variable,可选)-用于存储创建的Tensor,可以是程序中已经创建的任何Variable。默认值为None,此时将创建新的Variable来保存输出结果。 - - **dtype** (np.dtype|core.VarDesc.VarType|str,可选)- 输出Tensor的数据类型,支持数据类型为int32,int64。如果dtype为None,则会将dtype设置为int64。默认值为None。 - - **device** (str, 可选)-指定在GPU或CPU上创建Tensor。如果device为None,则将选择运行Paddle程序的设备,默认为None。 - - **stop_gradient** (bool,可选)-指定是否停止梯度计算,默认值为False。 - - **seed** (int,可选)-随机种子,用于生成样本。0表示使用系统生成的种子。注意如果种子不为0,该操作符每次都生成同样的随机数。默认为 0。 - - **name** (str,可选)-具体用法请参见:ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:表示一个随机初始化结果的Tensor,该Tensor的数据类型由dtype参数决定,该Tensor的维度由shape参数决定。 - -返回类型:Variable - -抛出异常: - - :code:`TypeError`: shape的类型应该是list、tuple 或 Variable。 - - :code:`TypeError`: dtype的类型应该是int32或int64。 - - :code:`ValueError`: 该OP的high必须大于low(high为None时,则会先将high设置为low,将low设置为0,再判断low和high的大小关系)。 - -**代码示例**: - -.. code-block:: python - - import paddle.fluid as fluid - - # example 1: - # attr shape is a list which doesn't contain tensor Variable. - result_1 = fluid.layers.randint(low=-5, high=5, shape=[3, 4], dtype="int64") - - # example 2: - # attr shape is a list which contains tensor Variable. - dim_1 = fluid.layers.fill_constant([1],"int64",3) - dim_2 = fluid.layers.fill_constant([1],"int32",5) - result_2 = fluid.layers.randint(low=-5, high=5, shape=[dim_1, dim_2], dtype="int32") - - # example 3: - # attr shape is a Variable, the data type must be int64 or int32. - var_shape = fluid.data(name='var_shape', shape=[2], dtype="int64") - result_3 = fluid.layers.randint(low=-5, high=5, shape=var_shape, dtype="int32") - var_shape_int32 = fluid.data(name='var_shape_int32', shape=[2], dtype="int32") - result_4 = fluid.layers.randint(low=-5, high=5, shape=var_shape_int32, dtype="int64") - - # example 4: - # Input only one parameter - # low=0, high=10, shape=[1], dtype='int64' - result_4 = fluid.layers.randint(10) +**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/randn_cn.rst b/doc/fluid/api_cn/layers_cn/randn_cn.rst similarity index 91% rename from doc/fluid/api_cn/tensor_cn/randn_cn.rst rename to doc/fluid/api_cn/layers_cn/randn_cn.rst index d7faca9d0..9a6a8633e 100644 --- a/doc/fluid/api_cn/tensor_cn/randn_cn.rst +++ b/doc/fluid/api_cn/layers_cn/randn_cn.rst @@ -3,7 +3,7 @@ randn ------------------------------- -.. py:function:: paddle.tensor.random.randn(shape, out=None, dtype=None, device=None, stop_gradient=True, name=None) +.. py:function:: paddle.fluid.layers.randn(shape, out=None, dtype=None, device=None, stop_gradient=True, name=None) 该 API 用于生成数据符合标准正态随机分布(均值为 0,方差为 1 的正态随机分布)的 Tensor。 @@ -26,7 +26,7 @@ randn # declarative mode import paddle import paddle.fluid as fluid - data = paddle.randn([2, 4]) + data = fluid.layers.randn([2, 4]) place = fluid.CPUPlace() exe = fluid.Executor(place) res, = exe.run(fluid.default_main_program(), feed={}, fetch_list=[data]) @@ -42,7 +42,7 @@ randn import paddle.fluid.dygraph as dg place = fluid.CPUPlace() with dg.guard(place) as g: - x = paddle.randn([2, 4]) + x = fluid.layers.randn([2, 4]) x_np = x.numpy() print(x_np) # [[ 1.5149173 -0.26234224 -0.592486 1.4523455 ] diff --git a/doc/fluid/api_cn/tensor_cn/randperm_cn.rst b/doc/fluid/api_cn/layers_cn/randperm_cn.rst similarity index 84% rename from doc/fluid/api_cn/tensor_cn/randperm_cn.rst rename to doc/fluid/api_cn/layers_cn/randperm_cn.rst index baaae52c5..1caa51914 100644 --- a/doc/fluid/api_cn/tensor_cn/randperm_cn.rst +++ b/doc/fluid/api_cn/layers_cn/randperm_cn.rst @@ -3,7 +3,7 @@ randperm ------------------------------- -.. py:function:: paddle.tensor.random.randperm(n, out=None, dtype="int64", device=None, stop_gradient=True, seed=0) +.. py:function:: paddle.fluid.layers.randperm(n, out=None, dtype="int64", device=None, stop_gradient=True, seed=0) 该OP返回一个数值在0到n-1、顺序随机的整数排列。 @@ -31,16 +31,16 @@ randperm # the random seed in computer, so the output in the next example # will be change. with fluid.dygraph.guard(): - out_1 = paddle.randperm(6) + out_1 = fluid.layers.randperm(6) print(out_1.numpy()) # Random permutation, for example [2 4 5 0 3 1] out_2 = fluid.dygraph.to_variable( np.array([0, 1, 2, 3])).astype(np.int64) - paddle.randperm(6, out_2) + fluid.layers.randperm(6, out_2) print(out_2.numpy()) # Random permutation, for example [5 0 2 4 1 3] - out_3 = paddle.randperm(6, dtype="int32", device="cpu") + out_3 = fluid.layers.randperm(6, dtype="int32", device="cpu") print(out_3.numpy()) # Random permutation, for example [3 1 4 2 5 0] - out_4 = paddle.randperm(6, device="cpu", stop_gradient=True) + out_4 = fluid.layers.randperm(6, device="cpu", stop_gradient=True) print(out_4.numpy()) # Random permutation, for example [3 1 5 2 0 4] diff --git a/doc/fluid/api_cn/tensor_cn/roll_cn.rst b/doc/fluid/api_cn/layers_cn/roll_cn.rst similarity index 88% rename from doc/fluid/api_cn/tensor_cn/roll_cn.rst rename to doc/fluid/api_cn/layers_cn/roll_cn.rst index 9998b6852..258c0c9e9 100644 --- a/doc/fluid/api_cn/tensor_cn/roll_cn.rst +++ b/doc/fluid/api_cn/layers_cn/roll_cn.rst @@ -3,7 +3,7 @@ roll ------------------------------- -.. py:function:: paddle.roll(input, shifts, dims=None): +.. py:function:: paddle.fluid.layers.roll(input, shifts, dims=None): 该OP沿着指定维度对输入 ``input`` 进行循环滚动,当元素移动到最后位置时,会从第一个位置重新插入。如果 ``dims`` 为 ``None`` ,则输入在被循环滚动之前,会先展平成 ``1-D Tensor`` ,滚动操作完成后恢复成原来的形状。 @@ -28,12 +28,12 @@ roll [7.0, 8.0, 9.0]]) with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(data) - out_z1 = paddle.roll(x, shifts=1) + out_z1 = fluid.layers.roll(x, shifts=1) print(out_z1.numpy()) #[[9. 1. 2.] # [3. 4. 5.] # [6. 7. 8.]] - out_z2 = paddle.roll(x, shifts=1, dims=0) + out_z2 = fluid.layers.roll(x, shifts=1, dims=0) print(out_z2.numpy()) #[[7. 8. 9.] # [1. 2. 3.] diff --git a/doc/fluid/api_cn/tensor_cn/t_cn.rst b/doc/fluid/api_cn/layers_cn/t_cn.rst similarity index 80% rename from doc/fluid/api_cn/tensor_cn/t_cn.rst rename to doc/fluid/api_cn/layers_cn/t_cn.rst index 4625ef706..051a1144c 100644 --- a/doc/fluid/api_cn/tensor_cn/t_cn.rst +++ b/doc/fluid/api_cn/layers_cn/t_cn.rst @@ -3,7 +3,7 @@ t ------------------------------- -.. py:function:: paddle.tensor.t(input, name=None) +.. py:function:: paddle.fluid.layers.t(input, name=None) 该OP对小于等于2维的Tensor进行数据转置。0维和1维Tensor返回本身,2维Tensor等价于perm设置为0,1的 :ref:`cn_api_fluid_layers_transpose` 函数。 @@ -21,16 +21,16 @@ t # 例1 (0-D tensor) x = tensor([0.79]) - paddle.t(x) = tensor([0.79]) + fluid.layers.t(x) = tensor([0.79]) # 例2 (1-D tensor) x = tensor([0.79, 0.84, 0.32]) - paddle.t(x) = tensor([0.79, 0.84, 0.32]) + fluid.layers.t(x) = tensor([0.79, 0.84, 0.32]) # 例3 (2-D tensor) x = tensor([0.79, 0.84, 0.32], [0.64, 0.14, 0.57]) - paddle.t(x) = tensor([0.79, 0.64], + fluid.layers.t(x) = tensor([0.79, 0.64], [0.84, 0.14], [0.32, 0.57]) @@ -42,7 +42,7 @@ t import paddle import paddle.fluid as fluid x = fluid.data(name='x', shape=[2, 3], dtype='float32') - x_transposed = paddle.t(x) # paddle.t 等价于 paddle.tensor.t + x_transposed = fluid.layers.t(x) # paddle.t 等价于 paddle.tensor.t print(x_transposed.shape) #(3L, 2L) diff --git a/doc/fluid/api_cn/framework_cn/set_default_dtype_cn.rst b/doc/fluid/api_cn/layers_cn/trace_cn.rst similarity index 90% rename from doc/fluid/api_cn/framework_cn/set_default_dtype_cn.rst rename to doc/fluid/api_cn/layers_cn/trace_cn.rst index 3d7928489..d1973d297 100644 --- a/doc/fluid/api_cn/framework_cn/set_default_dtype_cn.rst +++ b/doc/fluid/api_cn/layers_cn/trace_cn.rst @@ -1,3 +1,5 @@ -set +trace ------------------------------- **版本升级,文档正在开发中** + + diff --git a/doc/fluid/api_cn/tensor_cn/tril_cn.rst b/doc/fluid/api_cn/layers_cn/tril_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/tril_cn.rst rename to doc/fluid/api_cn/layers_cn/tril_cn.rst diff --git a/doc/fluid/api_cn/tensor_cn/triu_cn.rst b/doc/fluid/api_cn/layers_cn/triu_cn.rst similarity index 100% rename from doc/fluid/api_cn/tensor_cn/triu_cn.rst rename to doc/fluid/api_cn/layers_cn/triu_cn.rst diff --git a/doc/fluid/api_cn/nn_cn.rst b/doc/fluid/api_cn/nn_cn.rst deleted file mode 100644 index 16f0da595..000000000 --- a/doc/fluid/api_cn/nn_cn.rst +++ /dev/null @@ -1,20 +0,0 @@ -======================= -paddle.nn -======================= - - - - -.. toctree:: - :maxdepth: 1 - - nn_cn/Conv1D_cn.rst - nn_cn/Conv2D_cn.rst - nn_cn/diag_embed_cn.rst - nn_cn/interpolate_cn.rst - nn_cn/Linear_cn.rst - nn_cn/log_softmax_cn.rst - nn_cn/ReLU_cn.rst - nn_cn/Upsample_cn.rst - nn_cn/activation_cn.rst - nn_cn/loss_cn.rst diff --git a/doc/fluid/api_cn/nn_cn/Conv2D_cn.rst b/doc/fluid/api_cn/nn_cn/Conv2D_cn.rst deleted file mode 100644 index 24c985aff..000000000 --- a/doc/fluid/api_cn/nn_cn/Conv2D_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -Conv2D -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/Linear_cn.rst b/doc/fluid/api_cn/nn_cn/Linear_cn.rst deleted file mode 100644 index 2ffaf0736..000000000 --- a/doc/fluid/api_cn/nn_cn/Linear_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -Linear -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/ReLU_cn.rst b/doc/fluid/api_cn/nn_cn/ReLU_cn.rst deleted file mode 100644 index 687436b73..000000000 --- a/doc/fluid/api_cn/nn_cn/ReLU_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -ReLU -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/Upsample_cn.rst b/doc/fluid/api_cn/nn_cn/Upsample_cn.rst deleted file mode 100644 index c9257d1de..000000000 --- a/doc/fluid/api_cn/nn_cn/Upsample_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -Upsample -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/activation_cn.rst b/doc/fluid/api_cn/nn_cn/activation_cn.rst deleted file mode 100644 index 9bd3fa866..000000000 --- a/doc/fluid/api_cn/nn_cn/activation_cn.rst +++ /dev/null @@ -1,11 +0,0 @@ -======================= -activation -======================= - - - - -.. toctree:: - :maxdepth: 1 - - activation_cn/Sigmoid_cn.rst diff --git a/doc/fluid/api_cn/nn_cn/activation_cn/Sigmoid_cn.rst b/doc/fluid/api_cn/nn_cn/activation_cn/Sigmoid_cn.rst deleted file mode 100644 index 0754265b2..000000000 --- a/doc/fluid/api_cn/nn_cn/activation_cn/Sigmoid_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -Sigmoid -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/loss_cn.rst b/doc/fluid/api_cn/nn_cn/loss_cn.rst deleted file mode 100644 index 3c4c2c33f..000000000 --- a/doc/fluid/api_cn/nn_cn/loss_cn.rst +++ /dev/null @@ -1,15 +0,0 @@ -======================= -loss -======================= - - - - -.. toctree:: - :maxdepth: 1 - - loss_cn/BCELoss_cn.rst - loss_cn/CrossEntropyLoss_cn.rst - loss_cn/L1Loss_cn.rst - loss_cn/MSELoss_cn.rst - loss_cn/NLLLoss_cn.rst diff --git a/doc/fluid/api_cn/nn_cn/loss_cn/CrossEntropyLoss_cn.rst b/doc/fluid/api_cn/nn_cn/loss_cn/CrossEntropyLoss_cn.rst deleted file mode 100644 index 1e6a928c8..000000000 --- a/doc/fluid/api_cn/nn_cn/loss_cn/CrossEntropyLoss_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -CrossEntropyLoss -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/loss_cn/L1Loss_cn.rst b/doc/fluid/api_cn/nn_cn/loss_cn/L1Loss_cn.rst deleted file mode 100644 index b637fb12c..000000000 --- a/doc/fluid/api_cn/nn_cn/loss_cn/L1Loss_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -L1Loss -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/nn_cn/loss_cn/NLLLoss_cn.rst b/doc/fluid/api_cn/nn_cn/loss_cn/NLLLoss_cn.rst deleted file mode 100644 index 1436eeb08..000000000 --- a/doc/fluid/api_cn/nn_cn/loss_cn/NLLLoss_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -NLLLoss -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/add_cn.rst b/doc/fluid/api_cn/tensor_cn/add_cn.rst deleted file mode 100644 index bace507c2..000000000 --- a/doc/fluid/api_cn/tensor_cn/add_cn.rst +++ /dev/null @@ -1,173 +0,0 @@ -.. _cn_api_tensor_add: - -add -------------------------------- - -.. py:function:: paddle.add(x, y, alpha=1, out=None, name=None) - -该OP是逐元素相加算子,输入 ``x`` 与输入 ``y`` 逐元素相加,并将各个位置的输出元素保存到返回结果中。 - -等式为: - -.. math:: - Out = X + Y - -- :math:`X` :多维Tensor。 -- :math:`Y` :维度必须小于等于X维度的Tensor。 - -对于这个运算算子有2种情况: - 1. :math:`Y` 的 ``shape`` 与 :math:`X` 相同。 - 2. :math:`Y` 的 ``shape`` 是 :math:`X` 的连续子序列。 - -对于情况2: - 1. 用 :math:`Y` 匹配 :math:`X` 的形状(shape),其中 ``axis`` 是 :math:`Y` 在 :math:`X` 上的起始维度的位置。 - 2. 如果 ``axis`` 为-1(默认值),则 :math:`axis= rank(X)-rank(Y)` 。 - 3. 考虑到子序列, :math:`Y` 的大小为1的尾部维度将被忽略,例如shape(Y)=(2,1)=>(2)。 - -例如: - -.. code-block:: text - - shape(X) = (2, 3, 4, 5), shape(Y) = (,) - shape(X) = (2, 3, 4, 5), shape(Y) = (5,) - shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2 - shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1 - shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0 - shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0 - -参数: - - **x** (Variable)- 多维 ``Tensor`` 或 ``LoDTensor`` 。数据类型为 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64``。 - - **y** (Variable)- 多维 ``Tensor`` 或 ``LoDTensor`` 。数据类型为 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64``。 - - **alpha** (int|float,可选)- 输入y的缩放因子。默认值为1. 如果alpha不为1,本api计算公式变为 :math:`Out = X + alpha * Y` - - **out** (Variable,可选)- 指定存储运算结果的 ``Tensor`` 。如果设置为None或者不设置,将创建新的 ``Tensor`` 存储运算结果,默认值为None。 - - **name** (str,可选)- 输出的名字。默认值为None。该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。 - - -返回: 多维 ``Tensor`` 或 ``LoDTensor`` ,维度和数据类型都与 ``x`` 相同。 - -返回类型: Variable - -**代码示例 1** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.array([2, 3, 4]).astype('float32'), - "y": np.array([1, 5, 2]).astype('float32') - } - - x = fluid.data(name="x", shape=[3], dtype='float32') - y = fluid.data(name="y", shape=[3], dtype='float32') - z1 = paddle.add(x, y) - z2 = paddle.add(x, y, alpha=10) - # z = x + y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - z_value = exe.run(feed=gen_data(), - fetch_list=[z1.name, z2.name]) - - print(z_value[0]) # [3., 8., 6.] - print(z_value[1]) # [12. 53. 24.] - -**代码示例 2** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.ones((2, 3, 4, 5)).astype('float32'), - "y": np.zeros((4, 5)).astype('float32') - } - - x = fluid.data(name="x", shape=[2, 3, 4, 5], dtype='float32') - y = fluid.data(name="y", shape=[4, 5], dtype='float32') - z = paddle.add(x, y, name='z') - # z = x + y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - - z_value = exe.run(feed=gen_data(), - fetch_list=[z.name]) - - print(z_value[0]) - print(z_value[0].shape) # z.shape=[2,3,4,5] - -**代码示例 3** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.random.randint(1, 5, size=[2, 3, 4, 5]).astype('float32'), - "y": np.random.randint(1, 5, size=[5]).astype('float32') - } - - x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') - y = fluid.data(name="y", shape=[5], dtype='float32') - z = paddle.add(x, y) - # z = x / y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - - z_value = exe.run(feed=gen_data(), - fetch_list=[z.name]) - print(z_value[0]) - print(z_value[0].shape) # z.shape=[2,3,4,5] - - -**代码示例 4** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - x = fluid.data(name="x", shape=[3], dtype="float32") - y = fluid.data(name='y', shape=[3], dtype='float32') - - output = fluid.data(name="output", shape=[3], dtype="float32") - z = paddle.add(x, y, out=output) - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - data1 = np.array([2, 3, 4], dtype='float32') - data2 = np.array([1, 5, 2], dtype='float32') - z_value = exe.run(feed={'x': data1, - 'y': data2}, - fetch_list=[z]) - print(z_value[0]) # [3. 8. 6.] - - -**代码示例 5(动态图)** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - with fluid.dygraph.guard(): - np_x = np.array([2, 3, 4]).astype('float64') - np_y = np.array([1, 5, 2]).astype('float64') - x = fluid.dygraph.to_variable(np_x) - y = fluid.dygraph.to_variable(np_y) - z = paddle.add(x, y, alpha=-0.5) - np_z = z.numpy() - print(np_z) # [1.5, 0.5, 3. ] diff --git a/doc/fluid/api_cn/tensor_cn/argmax_cn.rst b/doc/fluid/api_cn/tensor_cn/argmax_cn.rst deleted file mode 100644 index a5bf212ec..000000000 --- a/doc/fluid/api_cn/tensor_cn/argmax_cn.rst +++ /dev/null @@ -1,63 +0,0 @@ -.. _cn_api_tensor_argmax: - -argmax -------------------------------- - -.. py:function:: paddle.argmax(input, axis=None, dtype=None, out=None, keepdims=False, name=None) - - -该OP沿 ``axis`` 计算输入 ``input`` 的最大元素的索引。 - -参数: - - **input** (Variable) - 输入的多维 ``Tensor`` ,支持的数据类型:float32、float64、int8、int16、int32、int64。 - - **axis** (int,可选) - 指定对输入Tensor进行运算的轴, ``axis`` 的有效范围是[-R, R),R是输入 ``input`` 的Rank, ``axis`` -R与绝对值相同的R等价。默认值为0。 - - **dtype** (np.dtype|core.VarDesc.VarType|str)- 输出Tensor的数据类型,可选值为int32,int64,默认值为None,将返回int64类型的结果。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - - **keepdims** (bool,可选)- 是否保留进行max index操作的维度,默认值为False。 - - **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回: ``Tensor`` ,数据类型int64 - -返回类型:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - in1 = np.array([[[5,8,9,5], - [0,0,1,7], - [6,9,2,4]], - [[5,2,4,2], - [4,7,7,9], - [1,7,0,6]]]) - with fluid.dygraph.guard(): - x = fluid.dygraph.to_variable(in1) - out1 = paddle.argmax(input=x, axis=-1) - out2 = paddle.argmax(input=x, axis=0) - out3 = paddle.argmax(input=x, axis=1) - out4 = paddle.argmax(input=x, axis=2) - out5 = paddle.argmax(input=x, axis=2, keepdims=True) - print(out1.numpy()) - # [[2 3 1] - # [0 3 1]] - print(out2.numpy()) - # [[0 0 0 0] - # [1 1 1 1] - # [0 0 0 1]] - print(out3.numpy()) - # [[2 2 0 1] - # [0 1 1 1]] - print(out4.numpy()) - # [[2 3 1] - # [0 3 1]] - print(out5.numpy()) - #array([[[2], - # [3], - # [1]], - # [[0], - # [3], - # [1]]]) diff --git a/doc/fluid/api_cn/tensor_cn/atan_cn.rst b/doc/fluid/api_cn/tensor_cn/atan_cn.rst deleted file mode 100644 index 382f6b09b..000000000 --- a/doc/fluid/api_cn/tensor_cn/atan_cn.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _cn_api_tensor_atan: - -atan -------------------------------- - -.. py:function:: paddle.atan(x, name=None, out=None) - -arctanh 激活函数。 - -.. math:: - out = tanh^{-1}(x) - -参数: - - **x(Variable)** - atan的输入Tensor,数据类型为 float32 或 float64 - - **name** (str|None) – 具体用法请参见 :ref:`cn_api_guide_Name` ,一般无需设置,默认值为None。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - -返回:返回类型为Variable(Tensor|LoDTensor), 数据类型同输入一致。 - -**代码示例**: - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - - inputs = fluid.layers.data(name="x", shape = [3], dtype='float32') - output = paddle.atan(inputs) - - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - - img = np.array([-0.8183, 0.4912, -0.6444, 0.0371]).astype(np.float32) - - res = exe.run(fluid.default_main_program(), feed={'x':img}, fetch_list=[output]) - print(res) - #[array([-0.6858003, 0.45658287, -0.5724284, 0.03708299], dtype=float32)] diff --git a/doc/fluid/api_cn/tensor_cn/cholesky_cn.rst b/doc/fluid/api_cn/tensor_cn/cholesky_cn.rst deleted file mode 100644 index c318bf86b..000000000 --- a/doc/fluid/api_cn/tensor_cn/cholesky_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -cholesky -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/concat_cn.rst b/doc/fluid/api_cn/tensor_cn/concat_cn.rst deleted file mode 100644 index e439959e9..000000000 --- a/doc/fluid/api_cn/tensor_cn/concat_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -concat -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/div_cn.rst b/doc/fluid/api_cn/tensor_cn/div_cn.rst deleted file mode 100755 index e69bb8480..000000000 --- a/doc/fluid/api_cn/tensor_cn/div_cn.rst +++ /dev/null @@ -1,154 +0,0 @@ -.. _cn_api_tensor_div: - -div -------------------------------- - -.. py:function:: paddle.div(x, y, out=None, name=None) - -该OP是逐元素相除算子,输入 ``x`` 与输入 ``y`` 逐元素相除,并将各个位置的输出元素保存到返回结果中。 - -等式是: - -.. math:: - Out = X / Y - -- :math:`X` :多维Tensor。 -- :math:`Y` :维度必须小于等于X维度的Tensor。 - -对于这个运算算子有2种情况: - 1. :math:`Y` 的 ``shape`` 与 :math:`X` 相同。 - 2. :math:`Y` 的 ``shape`` 是 :math:`X` 的连续子序列。 - -对于情况2: - 1. 用 :math:`Y` 匹配 :math:`X` 的形状(shape),其中 ``axis`` 是 :math:`Y` 在 :math:`X` 上的起始维度的位置。 - 2. 如果 ``axis`` 为-1(默认值),则 :math:`axis= rank(X)-rank(Y)` 。 - 3. 考虑到子序列, :math:`Y` 的大小为1的尾部维度将被忽略,例如shape(Y)=(2,1)=>(2)。 - -例如: - -.. code-block:: text - - shape(X) = (2, 3, 4, 5), shape(Y) = (,) - shape(X) = (2, 3, 4, 5), shape(Y) = (5,) - shape(X) = (2, 3, 4, 5), shape(Y) = (4, 5), with axis=-1(default) or axis=2 - shape(X) = (2, 3, 4, 5), shape(Y) = (3, 4), with axis=1 - shape(X) = (2, 3, 4, 5), shape(Y) = (2), with axis=0 - shape(X) = (2, 3, 4, 5), shape(Y) = (2, 1), with axis=0 - -参数: - - **x** (Variable)- 多维 ``Tensor`` 或 ``LoDTensor`` 。数据类型为 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64``。 - - **y** (Variable)- 多维 ``Tensor`` 或 ``LoDTensor`` 。数据类型为 ``float32`` 、 ``float64`` 、 ``int32`` 或 ``int64``。 - - **out** (Variable,可选)- 指定存储运算结果的 ``Tensor`` 。如果设置为None或者不设置,将创建新的 ``Tensor`` 存储运算结果,默认值为None。 - - **name** (str,可选)- 输出的名字。默认值为None。该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。 - - -返回: 多维 ``Tensor`` 或 ``LoDTensor`` , 维度和数据类型都与 ``x`` 相同。 - -返回类型: Variable - -**代码示例 1** - -.. code-block:: python - - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.array([2, 3, 4]).astype('float32'), - "y": np.array([1, 5, 2]).astype('float32') - } - - x = fluid.data(name="x", shape=[3], dtype='float32') - y = fluid.data(name="y", shape=[3], dtype='float32') - z = paddle.div(x, y) - # z = x / y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - z_value = exe.run(feed=gen_data(), - fetch_list=[z.name]) - - print(z_value) # [2., 0.6, 2.] - - -**代码示例 2** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.ones((2, 3, 4, 5)).astype('float32'), - "y": np.zeros((4, 5)).astype('float32') - } - - x = fluid.data(name="x", shape=[2, 3, 4, 5], dtype='float32') - y = fluid.data(name="y", shape=[4, 5], dtype='float32') - z = paddle.div(x, y, name='z') - # z = x / y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - - z_value = exe.run(feed=gen_data(), - fetch_list=[z.name]) - - print(z_value[0]) - print(z_value[0].shape) # z.shape=[2,3,4,5] - - -**代码示例 3** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - def gen_data(): - return { - "x": np.random.randint(1, 5, size=[2, 3, 4, 5]).astype('float32'), - "y": np.random.randint(1, 5, size=[5]).astype('float32') - } - - x = fluid.data(name="x", shape=[2,3,4,5], dtype='float32') - y = fluid.data(name="y", shape=[5], dtype='float32') - output = fluid.data(name="output", shape=[2,3,4,5], dtype="float32") - z = paddle.div(x, y, out=output) - # z = x / y - - place = fluid.CPUPlace() - exe = fluid.Executor(place) - - z_value = exe.run(feed=gen_data(), - fetch_list=[z.name]) - print(z_value[0]) - print(z_value[0].shape) # z.shape=[2,3,4,5] - - -**代码示例 4(动态图)** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - with fluid.dygraph.guard(fluid.CPUPlace()): - np_x = np.array([2, 3, 4]).astype('float64') - np_y = np.array([1, 5, 2]).astype('float64') - x = fluid.dygraph.to_variable(np_x) - y = fluid.dygraph.to_variable(np_y) - z = paddle.div(x, y) - np_z = z.numpy() - print(np_z) # [2., 0.6, 2.] - - - - diff --git a/doc/fluid/api_cn/tensor_cn/einsum_cn.rst b/doc/fluid/api_cn/tensor_cn/einsum_cn.rst deleted file mode 100644 index 7ea2cdba4..000000000 --- a/doc/fluid/api_cn/tensor_cn/einsum_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -einsum -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/elementwise_sum_cn.rst b/doc/fluid/api_cn/tensor_cn/elementwise_sum_cn.rst deleted file mode 100644 index 705d9d01f..000000000 --- a/doc/fluid/api_cn/tensor_cn/elementwise_sum_cn.rst +++ /dev/null @@ -1,75 +0,0 @@ -.. _cn_api_tensor_elementwise_sum: - -elementwise_sum -------------------------------- - -.. py:function:: paddle.elementwise_sum(inputs, name=None) - -该OP用于对输入的一至多个Tensor或LoDTensor求和。如果输入的是LoDTensor,输出仅与第一个输入共享LoD信息(序列信息)。 - -例1: -:: - 输入: - input.shape = [2, 3] - input = [[1, 2, 3], - [4, 5, 6]] - - 输出: - output.shape = [2, 3] - output = [[1, 2, 3], - [4, 5, 6]] - -例2: -:: - 输入: - 第一个输入: - input1.shape = [2, 3] - input1 = [[1, 2, 3], - [4, 5, 6]] - - 第二个输入: - input2.shape = [2, 3] - input2 = [[7, 8, 9], - [10, 11, 12]] - - 输出: - output.shape = [2, 3] - output = [[8, 10, 12], - [14, 16, 18]] - -参数: - - **inputs** (Variable|list(Variable)) - 输入的一至多个Variable。如果输入了多个Variable,则不同Variable间的shape和数据类型应保持一致。Variable为多维Tensor或LoDTensor,数据类型支持:float32,float64,int32,int64。 - - **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:对输入 ``inputs`` 中的Variable求和后的结果,shape和数据类型与 ``inputs`` 一致。 - -返回类型:Variable - - -**代码示例:** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - input0 = fluid.layers.fill_constant(shape=[2, 3], dtype='int64', value=5) - input1 = fluid.layers.fill_constant(shape=[2, 3], dtype='int64', value=3) - sum = paddle.elementwise_sum([input0, input1]) - - #用户可以通过executor打印出求和的结果 - out = fluid.layers.Print(sum, message="the sum of input0 and input1: ") - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_main_program()) - - #打印出的数据为: - 1570701754 the sum of input0 and input1: The place is:CPUPlace - Tensor[elementwise_sum_0.tmp_0] - shape: [2,3,] - dtype: l - data: 8,8,8,8,8,8, - - #输出了shape为[2,3]的Tensor,与输入的shape一致 - #dtype为对应C++数据类型,在不同环境下可能显示值不同,但本质相同 - #例如:如果Tensor中数据类型是int64,则对应的C++数据类型为int64_t,所以dtype值为typeid(int64_t).name(), - # 其在MacOS下为'x',linux下为'l',Windows下为'__int64',都表示64位整型变量 - diff --git a/doc/fluid/api_cn/tensor_cn/equal_cn.rst b/doc/fluid/api_cn/tensor_cn/equal_cn.rst deleted file mode 100644 index 428d1aaba..000000000 --- a/doc/fluid/api_cn/tensor_cn/equal_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -equal -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/erf_cn.rst b/doc/fluid/api_cn/tensor_cn/erf_cn.rst deleted file mode 100644 index ca07a4a13..000000000 --- a/doc/fluid/api_cn/tensor_cn/erf_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -erf -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/eye_cn.rst b/doc/fluid/api_cn/tensor_cn/eye_cn.rst deleted file mode 100644 index 7eca6037c..000000000 --- a/doc/fluid/api_cn/tensor_cn/eye_cn.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _cn_api_paddle_tensor_eye: - -eye -------------------------------- - -.. py:function:: paddle.tensor.eye(num_rows, num_columns=None, out=None, dtype='float32', stop_gradient=True, name=None) - -该OP用来构建单位矩阵。 - -参数: - - **num_rows** (int) - 生成单位矩阵的行数,数据类型为非负int32。 - - **num_columns** (int) - 生成单位矩阵的列数,数据类型为非负int32。若为None,则默认等于num_rows。 - - **out** (Variable, 可选) - 指定算子输出结果的LoDTensor/Tensor,可以是程序中已经创建的任何Variable。默认值为None,此时将创建新的Variable来保存输出结果。 - - **dtype** (string, 可选) - 返回张量的数据类型,可为int32,int64,float16,float32,float64。 - - **stop_gradient** (bool, 可选) - 是否对此OP停止计算梯度,默认值为False。 - - **name** (str, 可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:shape为 [num_rows, num_columns]的张量。 - -返回类型:Variable(Tensor|LoDTensor)数据类型为int32,int64,float16,float32,float64的Tensor或者LoDTensor。 - -**代码示例**: - -.. code-block:: python - - import paddle - data = paddle.eye(3, dtype='int32') # paddle.eye 等价于 paddle.tensor.eye - # [[1, 0, 0] - # [0, 1, 0] - # [0, 0, 1]] - data = paddle.eye(2, 3, dtype='int32') - # [[1, 0, 0] - # [0, 1, 0]] - - - - - diff --git a/doc/fluid/api_cn/tensor_cn/gather_cn.rst b/doc/fluid/api_cn/tensor_cn/gather_cn.rst deleted file mode 100644 index 430dd7ac8..000000000 --- a/doc/fluid/api_cn/tensor_cn/gather_cn.rst +++ /dev/null @@ -1,35 +0,0 @@ -.. _cn_api_paddle_tensor_gather -gather -------------------------------- - -.. py:function:: paddle.tensor.gather(input, index, overwrite=True) - -根据索引 index 获取输入(input)的最外层维度的条目,并将它们拼接在一起。 - -.. math:: - - Out=X[Index] - -**参数**: - - **input** (Variable) - 输入, 秩 ``rank >= 1`` , 支持的数据类型包括 int32、int64、float32、float64 和 uint8 (CPU)、float16(GPU) 。 - - **index** (Variable) - 索引,秩 ``rank = 1``, 数据类型为 int32 或 int64。 - - **overwrite** (bool) - 具有相同索引时在反向更新梯度的模式。如果为 ``True`` ,则使用覆盖模式更新相同索引的梯度;如果为 ``False`` ,则使用累积模式更新相同索引的梯度。默认值为 ``True`` 。 - -**返回**:和输入的秩相同的输出张量。 - -**返回类型**:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - with fluid.dygraph.guard(): - input_1 = np.array([[1,2,3],[4,5,6],[7,8,9]]) - index_1 = np.array([0,1]) - input = fluid.dygraph.to_variable(input_1) - index = fluid.dygraph.to_variable(index_1) - output = paddle.fluid.layers.gather(input, index) - # expected output: [[1, 2, 3],[4, 5, 6]] diff --git a/doc/fluid/api_cn/tensor_cn/inverse_cn.rst b/doc/fluid/api_cn/tensor_cn/inverse_cn.rst deleted file mode 100644 index ca3442242..000000000 --- a/doc/fluid/api_cn/tensor_cn/inverse_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -inverse -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/isnan_cn.rst b/doc/fluid/api_cn/tensor_cn/isnan_cn.rst deleted file mode 100644 index 2f22289cc..000000000 --- a/doc/fluid/api_cn/tensor_cn/isnan_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -isnan -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/linspace_cn.rst b/doc/fluid/api_cn/tensor_cn/linspace_cn.rst deleted file mode 100644 index 62f4bd6bd..000000000 --- a/doc/fluid/api_cn/tensor_cn/linspace_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -linspace -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/math_cn.rst b/doc/fluid/api_cn/tensor_cn/math_cn.rst deleted file mode 100644 index d16bb3003..000000000 --- a/doc/fluid/api_cn/tensor_cn/math_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -math -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/matmul_cn.rst b/doc/fluid/api_cn/tensor_cn/matmul_cn.rst deleted file mode 100644 index 80abf76a3..000000000 --- a/doc/fluid/api_cn/tensor_cn/matmul_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -matmul -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/max_cn.rst b/doc/fluid/api_cn/tensor_cn/max_cn.rst deleted file mode 100644 index b1023bf6c..000000000 --- a/doc/fluid/api_cn/tensor_cn/max_cn.rst +++ /dev/null @@ -1,54 +0,0 @@ - -.. _cn_api_paddle_tensor_max: - -max -------------------------------- - -.. py:function:: paddle.tensor.max(input, dim=None, keep_dim=False, out=None, name=None) - -该OP是对指定维度上的Tensor元素求最大值运算,并输出相应的计算结果。等价于 :ref:`cn_api_fluid_layers_reduce_max` - -参数: - - **input** (Variable)- 输入变量为多维Tensor或LoDTensor,支持数据类型为float32,float64,int32,int64。 - - **dim** (list | int ,可选)- 求最大值运算的维度。如果为None,则计算所有元素的最大值并返回包含单个元素的Tensor变量,否则必须在 :math:`[−rank(input),rank(input)]` 范围内。如果 :math:`dim [i] <0` ,则维度将变为 :math:`rank+dim[i]` ,默认值为None。 - - **keep_dim** (bool)- 是否在输出Tensor中保留减小的维度。如 keep_dim 为true,否则结果张量的维度将比输入张量小,默认值为False。 - - **out** (Variable, 可选) - 指定算子输出结果的LoDTensor/Tensor,可以是程序中已经创建的任何Variable。默认值为None,此时将创建新的Variable来保存输出结果。 - - **name** (str, 可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回: 在指定dim上进行求最大值运算的Tensor,数据类型和输入数据类型一致。 - -返回类型: 变量(Variable) - -**代码示例** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - # x是一个Tensor,元素如下: - # [[0.2, 0.3, 0.5, 0.9] - # [0.1, 0.2, 0.6, 0.7]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - x = fluid.data(name='x', shape=[2, 4], dtype='float32') - # paddle.max 等价于 paddle.tensor.max - paddle.max(x) # [0.9] - paddle.max(x, dim=0) # [0.2, 0.3, 0.6, 0.9] - paddle.max(x, dim=-1) # [0.9, 0.7] - paddle.max(x, dim=1, keep_dim=True) # [[0.9], [0.7]] - - # y是一个shape为[2, 2, 2]的Tensor,元素如下: - # [[[1.0, 2.0], [3.0, 4.0]], - # [[5.0, 6.0], [7.0, 8.0]]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32') - paddle.max(y, dim=[1, 2]) # [4.0, 8.0] - paddle.max(y, dim=[0, 1]) # [7.0, 8.0] - - - - - - - - - diff --git a/doc/fluid/api_cn/tensor_cn/min_cn.rst b/doc/fluid/api_cn/tensor_cn/min_cn.rst deleted file mode 100644 index b7b8838ff..000000000 --- a/doc/fluid/api_cn/tensor_cn/min_cn.rst +++ /dev/null @@ -1,53 +0,0 @@ -.. _cn_api_paddle_tensor_min: - -min -------------------------------- - -.. py:function:: paddle.tensor.min(input, dim=None, keep_dim=False, out=None, name=None) - -该OP是对指定维度上的Tensor元素求最小值运算,并输出相应的计算结果。等价于 :ref:`cn_api_fluid_layers_reduce_min` - -参数: - - **input** (Variable)- 输入变量为多维Tensor或LoDTensor,支持数据类型为float32,float64,int32,int64。 - - **dim** (list | int ,可选)- 求最小值运算的维度。如果为None,则计算所有元素的最小值并返回包含单个元素的Tensor变量,否则必须在 :math:`[−rank(input),rank(input)]` 范围内。如果 :math:`dim [i] <0` ,则维度将变为 :math:`rank+dim[i]` ,默认值为None。 - - **keep_dim** (bool)- 是否在输出Tensor中保留减小的维度。如 keep_dim 为true,否则结果张量的维度将比输入张量小,默认值为False。 - - **out** (Variable, 可选) - 指定算子输出结果的LoDTensor/Tensor,可以是程序中已经创建的任何Variable。默认值为None,此时将创建新的Variable来保存输出结果。 - - **name** (str, 可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回: 在指定dim上进行求最小值运算的Tensor,数据类型和输入数据类型一致。 - -返回类型: 变量(Variable) - -**代码示例** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - # x是一个Tensor,元素如下: - # [[0.2, 0.3, 0.5, 0.9] - # [0.1, 0.2, 0.6, 0.7]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - x = fluid.data(name='x', shape=[2, 4], dtype='float32') - # paddle.min 等价于 paddle.tensor.min - paddle.min(x) # [0.1] - paddle.min(x, dim=0) # [0.1, 0.2, 0.5, 0.7] - paddle.min(x, dim=-1) # [0.2, 0.1] - paddle.min(x, dim=1, keep_dim=True) # [[0.2], [0.1]] - - # y是一个shape为[2, 2, 2]的Tensor,元素如下: - # [[[1.0, 2.0], [3.0, 4.0]], - # [[5.0, 6.0], [7.0, 8.0]]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32') - paddle.min(y, dim=[1, 2]) # [1.0, 5.0] - paddle.min(y, dim=[0, 1]) # [1.0, 2.0] - - - - - - - - - diff --git a/doc/fluid/api_cn/tensor_cn/mm_cn.rst b/doc/fluid/api_cn/tensor_cn/mm_cn.rst deleted file mode 100644 index 3f32a20a2..000000000 --- a/doc/fluid/api_cn/tensor_cn/mm_cn.rst +++ /dev/null @@ -1,74 +0,0 @@ -.. _cn_api_tensor_mm: - -mm -------------------------------- - -.. py:function:: paddle.mm(input, mat2, out=None, name=None) - -用于两个输入矩阵的相乘。 - -两个输入的形状可为任意维度,但当任一输入维度大于3时,两个输入的维度必须相等。 - -如果原始 Tensor input 或 mat2 的秩为 1 且未转置,则矩阵相乘后的前置或附加维度 1 将移除。 - -参数: - - **input** (Variable) : 输入变量,类型为 Tensor 或 LoDTensor。 - - **mat2** (Variable) : 输入变量,类型为 Tensor 或 LoDTensor。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - - **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回: - - Variable (Tensor / LoDTensor),矩阵相乘后的结果。 - -返回类型: - - Variable(变量)。 - -:: - - * 例 1: - - input: [B, ..., M, K], mat2: [B, ..., K, N] - out: [B, ..., M, N] - - * 例 2: - - input: [B, M, K], mat2: [B, K, N] - out: [B, M, N] - - * 例 3: - - input: [B, M, K], mat2: [K, N] - out: [B, M, N] - - * 例 4: - - input: [M, K], mat2: [K, N] - out: [M, N] - - * 例 5: - - input: [B, M, K], mat2: [K] - out: [B, M] - - * 例 6: - - input: [K], mat2: [K] - out: [1] - - * 例 7: - - input: [M], mat2: [N] - out: [M, N] - - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - - input = fluid.data(name='input', shape=[2, 3], dtype='float32') - mat2 = fluid.data(name='mat2', shape=[3, 2], dtype='float32') - out = paddle.mm(input, mat2) # out shape is [2, 2] - diff --git a/doc/fluid/api_cn/tensor_cn/mul_cn.rst b/doc/fluid/api_cn/tensor_cn/mul_cn.rst deleted file mode 100644 index 00c305590..000000000 --- a/doc/fluid/api_cn/tensor_cn/mul_cn.rst +++ /dev/null @@ -1,45 +0,0 @@ -.. _cn_api_tensor_argmax: - -mul -------------------------------- - -.. py:function:: paddle.mul(x, y, x_num_col_dims=1, y_num_col_dims=1, out=None, name=None) - - -mul算子 -此运算是用于对输入x和y执行矩阵乘法。 -公式是: - -.. math:: - out = x * y - -输入x和y都可以携带LoD(详细程度)信息。但输出仅与输入x共享LoD信息。 - -参数: - - **x** (Variable) - 乘法运算的第一个输入张量Tensor/LoDTensor。 - - **y** (Variable) - 乘法运算的第二个输入张量Tensor/LoDTensor。 - - **x_num_col_dims** (int,可选) - 默认值1, 可以将具有两个以上维度的张量作为输入。如果输入x是具有多于两个维度的张量,则输入x将先展平为二维矩阵。展平规则是:前 ``num_col_dims`` 将被展平成最终矩阵的第一个维度(矩阵的高度),其余的 rank(x) - num_col_dims 维度被展平成最终矩阵的第二个维度(矩阵的宽度)。结果是展平矩阵的高度等于x的前 ``x_num_col_dims`` 维数的乘积,展平矩阵的宽度等于x的最后一个 rank(x)- ``num_col_dims`` 个剩余维度的维数的乘积。例如,假设x是一个5-D张量,形状为(2,3,4,5,6),并且 ``x_num_col_dims`` 的值为3。 则扁平化后的张量具有的形即为(2x3x4,5x6)=(24,30)。 - - **y_num_col_dims** (int,可选) - 默认值1, 可以将具有两个以上维度的张量作为输入。如果输入y是具有多于两个维度的张量,则y将首先展平为二维矩阵。 ``y_num_col_dims`` 属性确定y的展平方式。有关更多详细信息,请参阅 ``x_num_col_dims`` 的注释。 - - **out** (Variable, 可选) - 默认值None,如果out不为空,则矩阵乘法运算结果存储在out变量中。 - - **name** (str,可选) - 默认值None,输出的名称。该参数供开发人员打印调试信息时使用,具体用法参见 :ref:`api_guide_name`。当out和name同时不为空时,结果输出变量名与out保持一致。 - -返回:Variable(Tensor)乘法运算输出张量。 - -返回类型:变量(Variable)。 - -**代码示例** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - dataX = fluid.data(name="dataX", shape=[2, 5], dtype="float32") - dataY = fluid.data(name="dataY", shape=[5, 3], dtype="float32") - - res = fluid.data(name="output", shape=[2, 3], dtype="float32") - output = paddle.mul(dataX, dataY, - x_num_col_dims = 1, - y_num_col_dims = 1, - out=res) - - diff --git a/doc/fluid/api_cn/tensor_cn/norm_cn.rst b/doc/fluid/api_cn/tensor_cn/norm_cn.rst deleted file mode 100644 index 10c2254c6..000000000 --- a/doc/fluid/api_cn/tensor_cn/norm_cn.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _cn_api_tensor_norm: - -norm -------------------------------- - -.. py:function:: paddle.norm(input, p='fro', axis=None, keepdim=False, out=None, name=None): - -该OP将计算给定Tensor的矩阵范数(Frobenius 范数)和向量范数(向量1范数、2范数、或者通常的p范数). - -参数: - - **input** (Variable) - 输入Tensor。维度为多维,数据类型为float32或float64。 - - **p** (float|string, 可选) - 范数的种类。目前支持的值为 `fro`、 `1`、 `2`,和任何正实数p对应的p范数。 - - **axis** (int|list, 可选) - 使用范数计算的轴。如果 ``axis`` 为int或者只有一个元素的list,``norm`` API会计算输入Tensor的向量范数。如果axis为包含两个元素的list,API会计算输入Tensor的矩阵范数。 当 ``axis < 0`` 时,实际的计算维度为 rank(input) + axis。 - - **keepdim** (bool,可选) - 是否在输出的Tensor中保留和输入一样的维度,默认值为False。当 :attr:`keepdim` 为False时,输出的Tensor会比输入 :attr:`input` 的维度少一些。 - - **out** (Variable,可选) - 指定输出的Tensor,默认值为None。out的数据类型必须与输入 ``input`` 一致。 - - **name** (str|None) - 该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。默认值为None。 - - 返回:在指定axis上进行范数计算的Tensor,与输入input数据类型相同。 - - 返回类型:Variable,与输入input数据类型相同。 - -抛出异常: - - ``TypeError`` - 当输出 ``out`` 和输入 ``input`` 数据类型不一致时候。 - - ``ValueError`` - 当参数 ``p`` 或者 ``axis`` 不合法时。 - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - x = fluid.data(name='x', shape=[2, 3, 5], dtype='float64') - - # compute frobenius norm along last two dimensions. - out_fro = paddle.norm(x, p='fro', axis=[1,2]) - - # compute 2-order vector norm along last dimension. - out_pnorm = paddle.norm(x, p=2, axis=-1) diff --git a/doc/fluid/api_cn/tensor_cn/ones_cn.rst b/doc/fluid/api_cn/tensor_cn/ones_cn.rst deleted file mode 100644 index 86bfc73ea..000000000 --- a/doc/fluid/api_cn/tensor_cn/ones_cn.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. _cn_api_tensor_ones: - -ones -------------------------------- - -.. py:function:: paddle.ones(shape, dtype, out=None, device=None) - - -该OP创建形状为 ``shape`` 、数据类型为 ``dtype`` 且值全为1的Tensor。 - -参数: - - **shape** (tuple|list) - 输出Tensor的形状。 - - **dtype** (np.dtype|core.VarDesc.VarType|str) - 输出Tensor的数据类型,数据类型必须为float16、float32、float64、int32或int64。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - - **device** (str,可选) – 选择在哪个设备运行该操作,可选值包括None,'cpu'和'gpu'。如果 ``device`` 为None,则将选择运行Paddle程序的设备,默认为None。 - -返回:值全为1的Tensor,数据类型和 ``dtype`` 定义的类型一致。 - -返回类型:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - data = paddle.ones(shape=[3, 2], dtype='float32') # [[1., 1.], [1., 1.], [1., 1.]] - data = paddle.ones(shape=[2, 2], dtype='float32', device='cpu') # [[1., 1.], [1., 0.]] - diff --git a/doc/fluid/api_cn/tensor_cn/ones_like_cn.rst b/doc/fluid/api_cn/tensor_cn/ones_like_cn.rst deleted file mode 100644 index f373a61f1..000000000 --- a/doc/fluid/api_cn/tensor_cn/ones_like_cn.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. _cn_api_tensor_ones_like: - -ones_like -------------------------------- - -.. py:function:: paddle.ones_like(input, dtype=None, device=None, name=None) - - -该OP创建一个和input具有相同的形状和数据类型的全1Tensor。 - -参数: - - **input** (Variable) – 指定输入为一个多维的Tensor,数据类型可以是bool,float32,float64,int32,int64。 - - **dtype** (np.dtype|core.VarDesc.VarType|str, 可选)- 输出变量的数据类型。若参数为空,则输出变量的数据类型和输入变量相同,默认值为None。 - - **device** (str,可选) – 选择在哪个设备运行该操作,可选值包括None,'cpu'和'gpu'。如果 ``device`` 为None,则将选择运行Paddle程序的设备,默认为None。 - - **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:返回一个存储结果的Tensor。 - -返回类型:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - x = fluid.data(name='x', dtype='float32', shape=[3]) - data = paddle.ones_like(x) # data=[1.0, 1.0, 1.0] - data1 = paddle.ones_like(input=x, device="gpu") # data1=[1.0, 1.0. 1.0] diff --git a/doc/fluid/api_cn/tensor_cn/pow_cn.rst b/doc/fluid/api_cn/tensor_cn/pow_cn.rst deleted file mode 100644 index 8a354bff5..000000000 --- a/doc/fluid/api_cn/tensor_cn/pow_cn.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. _cn_api_tensor_argmax: - -pow -------------------------------- - -.. py:function:: paddle.pow(input, exponent, out=None, name=None): - -该OP是指数激活算子: - -.. math:: - out = x^{exponent} - -参数: - - **x** (Variable)- 多维 ``Tensor`` 或 ``LoDTensor`` ,数据类型为 ``float32`` 或 ``float64`` 。 - - **exponent** (float32|Variable,可选)- ``float32`` 或形状为[1]的 ``Tensor`` 或 ``LoDTensor``,数据类型为 ``float32``。Pow OP的指数因子。默认值:1.0。 - - **out** (Variable, 可选) - 默认值None,如果out不为空,则该运算结果存储在out变量中。 - - **name** (str,可选) - 默认值None,输出的名称。该参数供开发人员打印调试信息时使用,具体用法参见 :ref:`api_guide_name`。当out和name同时不为空时,结果输出变量名与out保持一致。 - -返回:维度与输入 `x` 相同的 ``Tensor`` 或 ``LoDTensor``,数据类型与 ``x`` 相同。 - -返回类型:Variable。 - - -**代码示例:** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - x = fluid.data(name="x", shape=[32,32], dtype="float32") - - # 示例1: 参数exponent是个浮点数 - res = fluid.data(name="output", shape=[32,32], dtype="float32") - y_1 = paddle.pow(x, 2.0, out=res) - # y_1 is x^{2.0} - - # 示例2: 参数exponent是个变量 - exponent_tensor = fluid.layers.fill_constant([1], "float32", 3.0) - res = fluid.data(name="output", shape=[32,32], dtype="float32") - y_2 = paddle.pow(x, exponent_tensor, out=res) - # y_2 is x^{3.0} \ No newline at end of file diff --git a/doc/fluid/api_cn/tensor_cn/rand_cn.rst b/doc/fluid/api_cn/tensor_cn/rand_cn.rst deleted file mode 100644 index b1c5e32b1..000000000 --- a/doc/fluid/api_cn/tensor_cn/rand_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -rand -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/randint_cn.rst b/doc/fluid/api_cn/tensor_cn/randint_cn.rst deleted file mode 100644 index c12490bfd..000000000 --- a/doc/fluid/api_cn/tensor_cn/randint_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -randint -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/sin_cn.rst b/doc/fluid/api_cn/tensor_cn/sin_cn.rst deleted file mode 100644 index 7a94b3fbd..000000000 --- a/doc/fluid/api_cn/tensor_cn/sin_cn.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _cn_api_tensor_sin: - -sin -------------------------------- - -.. py:function:: paddle.sin(x, name=None, out=None) - -计算输入的正弦值。 - -.. math:: - out = sin(x) - -参数: - - **x** (Variable) - 支持任意维度的Tensor。数据类型为float32,float64或float16。 - - **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - -返回:返回类型为Variable(Tensor|LoDTensor), 数据类型同输入一致。 - -**代码示例**: - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - - inputs = fluid.layers.data(name="x", shape = [3], dtype='float32') - output = paddle.sin(inputs) - - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - - img = np.array([0, 45, 90]).astype(np.float32) - - res = exe.run(fluid.default_main_program(), feed={'x':img}, fetch_list=[output]) - print(res) - # [array([0. , 0.8509035 , 0.89399666], dtype=float32)] diff --git a/doc/fluid/api_cn/tensor_cn/sort_cn.rst b/doc/fluid/api_cn/tensor_cn/sort_cn.rst deleted file mode 100644 index 52bb75ec9..000000000 --- a/doc/fluid/api_cn/tensor_cn/sort_cn.rst +++ /dev/null @@ -1,69 +0,0 @@ -.. _cn_api_tensor_sort: - -sort -------------------------------- - -.. py:function:: paddle.sort(input, axis=-1, descending=False, out=None, name=None) - -对输入变量沿给定轴进行排序,输出排序好的数据和相应的索引,其维度和输入相同。**默认升序排列,如果需要降序排列设置** ``descending=True`` 。 - - -参数: - - **input** (Variable) - 输入的多维 ``Tensor`` ,支持的数据类型:float32、float64、int16、int32、int64、uint8。 - - **axis** (int,可选) - 指定对输入Tensor进行运算的轴, ``axis`` 的有效范围是[-R, R),R是输入 ``x`` 的Rank, ``axis`` 为负时与 ``axis`` +R 等价。默认值为0。 - - **descending** (bool,可选) - 指定算法排序的方向。如果设置为True,算法按照降序排序。如果设置为False或者不设置,按照升序排序。默认值为False。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor(与 ``input`` 维度相同、数据类型相同)。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - - **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:一组已排序的输出(与 ``input`` 维度相同、数据类型相同)和索引(数据类型为int64)。 - -返回类型:tuple[Variable] - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - - in1 = np.array([[[5,8,9,5], - [0,0,1,7], - [6,9,2,4]], - [[5,2,4,2], - [4,7,7,9], - [1,7,0,6]]]).astype(np.float32) - with fluid.dygraph.guard(): - x = fluid.dygraph.to_variable(in1) - out1 = paddle.sort(input=x, axis=-1) # same as axis==2 - out2 = paddle.sort(input=x, axis=0) - out3 = paddle.sort(input=x, axis=1) - print(out1[0].numpy()) - # [[[5. 5. 8. 9.] - # [0. 0. 1. 7.] - # [2. 4. 6. 9.]] - # [[2. 2. 4. 5.] - # [4. 7. 7. 9.] - # [0. 1. 6. 7.]]] - print(out1[1].numpy()) - # [[[0 3 1 2] - # [0 1 2 3] - # [2 3 0 1]] - # [[1 3 2 0] - # [0 1 2 3] - # [2 0 3 1]]] - print(out2[0].numpy()) - # [[[5. 2. 4. 2.] - # [0. 0. 1. 7.] - # [1. 7. 0. 4.]] - # [[5. 8. 9. 5.] - # [4. 7. 7. 9.] - # [6. 9. 2. 6.]]] - print(out3[0].numpy()) - # [[[0. 0. 1. 4.] - # [5. 8. 2. 5.] - # [6. 9. 9. 7.]] - # [[1. 2. 0. 2.] - # [4. 7. 4. 6.] - # [5. 7. 7. 9.]]] - diff --git a/doc/fluid/api_cn/tensor_cn/split_cn.rst b/doc/fluid/api_cn/tensor_cn/split_cn.rst deleted file mode 100644 index a22576603..000000000 --- a/doc/fluid/api_cn/tensor_cn/split_cn.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. _cn_api_paddle_tensor_split -split -------------------------------- - -.. py:function:: paddle.tensor.split(input, num_or_sections, dim=-1, name=None) - -该OP将输入Tensor分割成多个子Tensor。 - -**参数**: - - **input** (Variable) - 输入变量,数据类型为float32,float64,int32,int64的多维Tensor或者LoDTensor。 - - **num_or_sections** (int|list|tuple) - 如果 num_or_sections 是一个整数,则表示Tensor平均划分为相同大小子Tensor的数量。如果 num_or_sections 是一个list或tuple,那么它的长度代表子Tensor的数量,它的元素可以是整数或者形状为[1]的Tensor,依次代表子Tensor需要分割成的维度的大小。list或tuple的长度不能超过输入Tensor待分割的维度的大小。在list或tuple中,至多有一个元素值为-1,表示该值是由input的维度和其他num_or_sections中元素推断出来的。例如对一个维度为[4,6,6]Tensor的第三维进行分割时,指定num_or_sections=[2,-1,1],输出的三个Tensor维度分别为:[4,6,2],[4,6,3],[4,6,1]。 - - **dim** (int|Variable,可选) - 整数或者形状为[1]的Tensor,数据类型为int32或int64。表示需要分割的维度。如果dim < 0,则划分的维度为rank(input) + dim。默认值为-1。 - - **name** (str,可选) - 一般无需设置,默认值为None。 - -**返回**:分割后的Tensor列表。 - -**返回类型**:列表(Variable(Tensor|LoDTensor)),数据类型为int32,int64,float32,float64。 - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - with fluid.dygraph.guard(): - input_1 = np.random.random([4, 6, 6]).astype("int32") - # input is a variable which shape is [4, 6, 6] - input = fluid.dygraph.to_variable(input_1) - - x0, x1, x2 = paddle.split(input, num_or_sections= 3, dim=1) - # x0.shape [4, 2, 6] - # x1.shape [4, 2, 6] - # x2.shape [4, 2, 6] diff --git a/doc/fluid/api_cn/tensor_cn/sqrt_cn.rst b/doc/fluid/api_cn/tensor_cn/sqrt_cn.rst deleted file mode 100644 index b8a5a2b93..000000000 --- a/doc/fluid/api_cn/tensor_cn/sqrt_cn.rst +++ /dev/null @@ -1,42 +0,0 @@ -.. _cn_api_tensor_sqrt: - -sqrt -------------------------------- - -.. py:function:: paddle.sqrt(x, name=None, out=None) - -计算输入的算数平方根。 - -.. math:: - out=\sqrt x=x^{1/2} - -.. note:: - 请确保输入中的数值是非负数。 - -参数: - - - **x** (Variable) - 支持任意维度的Tensor。数据类型为float32,float64或float16。 - - **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - -返回:返回类型为Variable(Tensor|LoDTensor), 数据类型同输入一致。 - -**代码示例**: - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - - inputs = fluid.layers.data(name="x", shape = [3], dtype='float32') - output = paddle.sqrt(inputs) - - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - - img = np.array([0, 9, 36]).astype(np.float32) - - res = exe.run(fluid.default_main_program(), feed={'x':img}, fetch_list=[output]) - print(res) - # [array([0., 3., 6.], dtype=float32)] diff --git a/doc/fluid/api_cn/tensor_cn/squeeze_cn.rst b/doc/fluid/api_cn/tensor_cn/squeeze_cn.rst deleted file mode 100644 index 795cf298a..000000000 --- a/doc/fluid/api_cn/tensor_cn/squeeze_cn.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _cn_api_paddle_tensor_squeeze -squeeze -------------------------------- - -.. py:function:: paddle.tensor.squeeze(input, zxes, name=None) - -该OP会根据axes压缩输入Tensor的维度。如果指定了axes,则会删除axes中指定的维度,axes指定的维度要等于1。如果没有指定axes,那么所有等于1的维度都会被删除。 - -**参数**: - - **input** (Variable) - 输入任意维度的Tensor。 支持的数据类型:float32,float64,int8,int32,int64。 - - **axes** (list) - 输入一个或一列整数,代表要压缩的轴。axes的范围: [−rank(input),rank(input))] 。 axes为负数时, axes=axes+rank(input) 。 - - **name** (str,可选) - 一般无需设置,默认值为None。 - -**返回**:返回对维度进行压缩后的Tensor。数据类型与输入Tensor一致。 - -**返回类型**:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - with fluid.dygraph.guard(): - input_1 = np.random.random([5, 1, 10]).astype("int32") - # input is a variable which shape is [5, 1, 10] - input = fluid.dygraph.to_variable(input_1) - - output = paddle.fluid.layers.squeeze(input, axes=[1]) - # output.shape [5, 10] diff --git a/doc/fluid/api_cn/tensor_cn/stack_cn.rst b/doc/fluid/api_cn/tensor_cn/stack_cn.rst deleted file mode 100644 index 0351b65a4..000000000 --- a/doc/fluid/api_cn/tensor_cn/stack_cn.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. _cn_api_paddle_tensor_arange -stack -------------------------------- - -.. py:function:: paddle.tensor.stack(x, axis=0) - -该OP沿 axis 轴对输入 x 进行堆叠操作。 - -**参数**: - - **x** (Variable|list(Variable)) – 输入 x 可以是单个Tensor,或是多个Tensor组成的列表。如果 x 是一个列表,那么这些Tensor的维度必须相同。 假设输入是N维Tensor [d0,d1,...,dn−1],则输出变量的维度为N+1维 [d0,d1,...daxis−1,len(x),daxis...,dn−1] 。支持的数据类型: float32,float64,int32,int64。 - - - **axis** (int, 可选) – 指定对输入Tensor进行堆叠运算的轴,有效 axis 的范围是: [−(R+1),R+1)],R是输入中第一个Tensor的rank。如果 axis < 0,则 axis=axis+rank(x[0])+1 。axis默认值为0。 - -**返回**:堆叠运算后的Tensor,数据类型与输入Tensor相同。输出维度等于 rank(x[0])+1 维。 - -**返回类型**:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - data1 = np.array([[1.0, 2.0,3.0]]) - data2 = np.array([[3.0, 4.0, 5.0]]) - data3 = np.array([[5.0, 6.0,7.0]]) - with fluid.dygraph.guard(): - x1 = fluid.dygraph.to_variable(data1) - x2 = fluid.dygraph.to_variable(data2) - x3 = fluid.dygraph.to_variable(data3) - result = paddle.stack([x1, x2, x3], axis=2) - # result shape: [3, 1, 2] - # result value: [[[1.0, 2.0]], - # [[3.0, 4.0]], - # [[5.0, 6.0]]] diff --git a/doc/fluid/api_cn/tensor_cn/std_cn.rst b/doc/fluid/api_cn/tensor_cn/std_cn.rst deleted file mode 100644 index 46b22e08e..000000000 --- a/doc/fluid/api_cn/tensor_cn/std_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -std -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/sum_cn.rst b/doc/fluid/api_cn/tensor_cn/sum_cn.rst deleted file mode 100644 index 7b7f57628..000000000 --- a/doc/fluid/api_cn/tensor_cn/sum_cn.rst +++ /dev/null @@ -1,43 +0,0 @@ -.. _cn_api_tensor_sum: - -sum -------------------------------- - -.. py:function:: paddle.sum(input, dim=None, dtype=None, keep_dim=False, name=None) - -该OP是对指定维度上的Tensor元素进行求和运算,并输出相应的计算结果。 - -参数: - - **input** (Variable)- 输入变量为多维Tensor或LoDTensor,支持数据类型为float32,float64,int32,int64。 - - **dim** (list | int ,可选)- 求和运算的维度。如果为None,则计算所有元素的和并返回包含单个元素的Tensor变量,否则必须在 :math:`[−rank(input),rank(input)]` 范围内。如果 :math:`dim [i] <0` ,则维度将变为 :math:`rank+dim[i]` ,默认值为None。 - - **dtype** (str , 可选)- 输出变量的数据类型。若参数为空,则输出变量的数据类型和输入变量相同,默认值为None。 - - **keep_dim** (bool)- 是否在输出Tensor中保留减小的维度。如 keep_dim 为true,否则结果张量的维度将比输入张量小,默认值为False。 - - **name** (str , 可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回: 在指定dim上进行求和运算的Tensor,数据类型和输入数据类型一致。 - -返回类型: 变量(Variable) - -**代码示例** - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - # x是一个Tensor,元素如下: - # [[0.2, 0.3, 0.5, 0.9] - # [0.1, 0.2, 0.6, 0.7]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - x = fluid.data(name='x', shape=[2, 4], dtype='float32') - out1 = paddle.sum(x) # [3.5] - out2 = paddle.sum(x, dim=0) # [0.3, 0.5, 1.1, 1.6] - out3 = paddle.sum(x, dim=-1) # [1.9, 1.6] - out4 = paddle.sum(x, dim=1, keep_dim=True) # [[1.9], [1.6]] - - # y 是一个shape为[2, 2, 2]的Tensor元素如下: - # [[[1, 2], [3, 4]], - # [[5, 6], [7, 8]]] - # 接下来的示例中,我们在每处函数调用后面都标注出了它的结果张量。 - y = fluid.data(name='y', shape=[2, 2, 2], dtype='float32') - out5 = paddle.sum(y, dim=[1, 2]) # [10, 26] - out6 = paddle.sum(y, dim=[0, 1]) # [16, 20] diff --git a/doc/fluid/api_cn/tensor_cn/tanh_cn.rst b/doc/fluid/api_cn/tensor_cn/tanh_cn.rst deleted file mode 100644 index c36b1200a..000000000 --- a/doc/fluid/api_cn/tensor_cn/tanh_cn.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. _cn_api_tensor_tanh: - -tanh -------------------------------- - -.. py:function:: paddle.tanh(x, name=None, out=None) - -tanh 激活函数 - -.. math:: - out = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}} - - -参数: - - - **x** (Variable) - 支持任意维度的Tensor。数据类型为float32,float64或float16。 - - **name** (str,可选) – 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - -返回:返回类型为Variable(Tensor|LoDTensor), 数据类型同输入一致。 - -**代码示例**: - -.. code-block:: python - - import numpy as np - import paddle - import paddle.fluid as fluid - - inputs = fluid.layers.data(name="x", shape = [3], dtype='float32') - output = paddle.tanh(inputs) - - exe = fluid.Executor(fluid.CPUPlace()) - exe.run(fluid.default_startup_program()) - - img = np.array([0, 0.5, 0.3]).astype(np.float32) - - res = exe.run(fluid.default_main_program(), feed={'x':img}, fetch_list=[output]) - print(res) - # [array([0., 0.46211717, 0.2913126], dtype=float32)] diff --git a/doc/fluid/api_cn/tensor_cn/tensordot_cn.rst b/doc/fluid/api_cn/tensor_cn/tensordot_cn.rst deleted file mode 100644 index c6fc45ede..000000000 --- a/doc/fluid/api_cn/tensor_cn/tensordot_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -tensordot -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/transpose_cn.rst b/doc/fluid/api_cn/tensor_cn/transpose_cn.rst deleted file mode 100644 index 7ade0a692..000000000 --- a/doc/fluid/api_cn/tensor_cn/transpose_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -transpose -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/unbind_cn.rst b/doc/fluid/api_cn/tensor_cn/unbind_cn.rst deleted file mode 100644 index c5b287c1f..000000000 --- a/doc/fluid/api_cn/tensor_cn/unbind_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -unbind -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/unsqueeze_cn.rst b/doc/fluid/api_cn/tensor_cn/unsqueeze_cn.rst deleted file mode 100644 index 6b1face48..000000000 --- a/doc/fluid/api_cn/tensor_cn/unsqueeze_cn.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _cn_api_paddle_tensor_unsqueeze -unsqueeze -------------------------------- - -.. py:function:: paddle.tensor.unsqueeze(input, axes, name=None) - -该OP向输入(input)的shape中一个或多个位置(axes)插入维度。 - -**参数**: - - **input** (Variable)- 多维 Tensor,数据类型为 float32, float64, int8, int32,或 int64。 - - **axes** (int|list|tuple|Variable) - 表示要插入维度的位置。数据类型是 int32 。如果 axes 的类型是 list 或 tuple,它的元素可以是整数或者形状为[1]的 Tensor 。如果 axes 的类型是 Variable,则是1-D Tensor。 - - **name** (str,可选)- 一般无需设置。默认值: None。 - -**返回**:扩展维度后的多维Tensor - -**返回类型**:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - import numpy as np - with fluid.dygraph.guard(): - input_1 = np.random.random([5, 10]).astype("int32") - # input is a variable which shape is [5, 1, 10] - input = fluid.dygraph.to_variable(input_1) - - output = paddle.unsqueeze(input, axes=[1]) - # output.shape [5, 1, 10] diff --git a/doc/fluid/api_cn/tensor_cn/var_cn.rst b/doc/fluid/api_cn/tensor_cn/var_cn.rst deleted file mode 100644 index 93c13b558..000000000 --- a/doc/fluid/api_cn/tensor_cn/var_cn.rst +++ /dev/null @@ -1,3 +0,0 @@ -var -------------------------------- -**版本升级,文档正在开发中** diff --git a/doc/fluid/api_cn/tensor_cn/zeros_cn.rst b/doc/fluid/api_cn/tensor_cn/zeros_cn.rst deleted file mode 100644 index 681d45fe5..000000000 --- a/doc/fluid/api_cn/tensor_cn/zeros_cn.rst +++ /dev/null @@ -1,27 +0,0 @@ -.. _cn_api_tensor_zeros: - -zeros -------------------------------- - -.. py:function:: paddle.zeros(shape, dtype, out=None, device=None) - -该OP创建形状为 ``shape`` 、数据类型为 ``dtype`` 且值全为0的Tensor。 - -参数: - - **shape** (tuple|list) - 输出Tensor的形状。 - - **dtype** (np.dtype|core.VarDesc.VarType|str) - 输出Tensor的数据类型,数据类型必须为float16、float32、float64、int32或int64。 - - **out** (Variable, 可选) – 指定存储运算结果的Tensor。如果设置为None或者不设置,将创建新的Tensor存储运算结果,默认值为None。 - - **device** (str,可选) – 选择在哪个设备运行该操作,可选值包括None,'cpu'和'gpu'。如果 ``device`` 为None,则将选择运行Paddle程序的设备,默认为None。 - -返回:值全为0的Tensor,数据类型和 ``dtype`` 定义的类型一致。 - -返回类型:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - data = paddle.zeros(shape=[3, 2], dtype='float32') # [[0., 0.], [0., 0.], [0., 0.]] - data = paddle.zeros(shape=[2, 2], dtype='float32', device='cpu') # [[0., 0.], [0., 0.]] - diff --git a/doc/fluid/api_cn/tensor_cn/zeros_like_cn.rst b/doc/fluid/api_cn/tensor_cn/zeros_like_cn.rst deleted file mode 100644 index babee57d2..000000000 --- a/doc/fluid/api_cn/tensor_cn/zeros_like_cn.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. _cn_api_tensor_zeros_like: - -zeros_like -------------------------------- - -.. py:function:: paddle.zeros_like(input, dtype=None, device=None, name=None) - - -该OP创建一个和input具有相同的形状和数据类型的全零Tensor。 - -参数: - - **input** (Variable) – 指定输入为一个多维的Tensor,数据类型可以是bool,float32,float64,int32,int64。 - - **dtype** (np.dtype|core.VarDesc.VarType|str, 可选)- 输出变量的数据类型。若参数为空,则输出变量的数据类型和输入变量相同,默认值为None。 - - **device** (str,可选) – 选择在哪个设备运行该操作,可选值包括None,'cpu'和'gpu'。如果 ``device`` 为None,则将选择运行Paddle程序的设备,默认为None。 - - **name** (str,可选)- 具体用法请参见 :ref:`api_guide_Name` ,一般无需设置,默认值为None。 - -返回:返回一个存储结果的Tensor。 - -返回类型:Variable - -**代码示例**: - -.. code-block:: python - - import paddle - import paddle.fluid as fluid - x = fluid.data(name='x', dtype='float32', shape=[3]) - data1 = paddle.ones_like(input=x, device="gpu") # data1=[1.0, 1.0. 1.0] - -- GitLab