From 526a13ff5836b7b8ee899425d86b2c5f95a222bc Mon Sep 17 00:00:00 2001 From: XiaoguangHu <46782768+XiaoguangHu01@users.noreply.github.com> Date: Sun, 26 Apr 2020 19:55:57 +0800 Subject: [PATCH] define fluid alias in paddle.tensor and paddle.nn dir (#24151) * define fluid alias in paddle.tensor and paddle.nn dir test=develop * from layer import loss in paddle.nn dir test=develop --- python/paddle/__init__.py | 273 +++++++-------- python/paddle/nn/__init__.py | 307 ++++------------- python/paddle/nn/clip.py | 21 +- python/paddle/nn/control_flow.py | 20 +- python/paddle/nn/decode.py | 21 +- python/paddle/nn/functional/__init__.py | 333 +++++++++---------- python/paddle/nn/functional/activation.py | 64 ++-- python/paddle/nn/functional/common.py | 36 +- python/paddle/nn/functional/conv.py | 1 + python/paddle/nn/functional/extension.py | 33 +- python/paddle/nn/functional/learning_rate.py | 22 +- python/paddle/nn/functional/lod.py | 62 ++-- python/paddle/nn/functional/loss.py | 64 ++-- python/paddle/nn/functional/norm.py | 21 +- python/paddle/nn/functional/pooling.py | 10 +- python/paddle/nn/functional/rnn.py | 9 +- python/paddle/nn/functional/vision.py | 105 +++--- python/paddle/nn/initalizer.py | 17 +- python/paddle/nn/input.py | 7 +- python/paddle/nn/layer/__init__.py | 39 +++ python/paddle/nn/layer/activation.py | 5 +- python/paddle/nn/layer/common.py | 17 +- python/paddle/nn/layer/conv.py | 5 +- python/paddle/nn/layer/extension.py | 2 +- python/paddle/nn/layer/learning_rate.py | 17 +- python/paddle/nn/layer/loss.py | 3 +- python/paddle/nn/layer/norm.py | 14 +- python/paddle/nn/layer/rnn.py | 7 +- python/paddle/tensor/__init__.py | 253 +++++++------- python/paddle/tensor/attribute.py | 5 +- python/paddle/tensor/creation.py | 23 +- python/paddle/tensor/io.py | 5 +- python/paddle/tensor/linalg.py | 8 +- python/paddle/tensor/logic.py | 42 ++- python/paddle/tensor/manipulation.py | 52 +-- python/paddle/tensor/math.py | 141 +++++--- python/paddle/tensor/random.py | 19 +- python/paddle/tensor/search.py | 20 +- python/paddle/tensor/stat.py | 10 +- python/paddle/tensor/tensor.py | 7 +- 40 files changed, 1099 insertions(+), 1021 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index 8abd1eb7ee..65984c600d 100644 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -41,97 +41,123 @@ import paddle.imperative import paddle.complex # TODO: define alias in tensor and framework directory -# from .tensor.creation import create_.tensor #DEFINE_ALIAS -# from .tensor.creation import create_lod_.tensor #DEFINE_ALIAS -# from .tensor.creation import create_random_int_lod.tensor #DEFINE_ALIAS -# from .tensor.creation import crop_.tensor #DEFINE_ALIAS -# from .tensor.creation import diag #DEFINE_ALIAS +from .tensor.random import randperm +from .tensor.attribute import rank #DEFINE_ALIAS +from .tensor.attribute import shape #DEFINE_ALIAS +# from .tensor.creation import create_tensor #DEFINE_ALIAS +# from .tensor.creation import create_lod_tensor #DEFINE_ALIAS +# from .tensor.creation import create_random_int_lodtensor #DEFINE_ALIAS +from .tensor.creation import crop_tensor #DEFINE_ALIAS +from .tensor.creation import diag #DEFINE_ALIAS from .tensor.creation import eye #DEFINE_ALIAS from .tensor.creation import fill_constant #DEFINE_ALIAS -# from .tensor.creation import get_.tensor_from_selected_rows #DEFINE_ALIAS +# from .tensor.creation import get_tensor_from_selected_rows #DEFINE_ALIAS from .tensor.creation import linspace #DEFINE_ALIAS from .tensor.creation import ones #DEFINE_ALIAS from .tensor.creation import ones_like #DEFINE_ALIAS -# from .tensor.creation import range #DEFINE_ALIAS from .tensor.creation import zeros #DEFINE_ALIAS from .tensor.creation import zeros_like #DEFINE_ALIAS from .tensor.creation import arange #DEFINE_ALIAS -# from .tensor.creation import eye #DEFINE_ALIAS +from .tensor.creation import eye #DEFINE_ALIAS from .tensor.creation import full #DEFINE_ALIAS -# from .tensor.creation import linspace #DEFINE_ALIAS from .tensor.creation import full_like #DEFINE_ALIAS -# from .tensor.creation import triu #DEFINE_ALIAS -# from .tensor.creation import tril #DEFINE_ALIAS +from .tensor.creation import triu #DEFINE_ALIAS +from .tensor.creation import tril #DEFINE_ALIAS from .tensor.creation import meshgrid #DEFINE_ALIAS -# from .tensor.stat import mean #DEFINE_ALIAS -# from .tensor.stat import reduce_mean #DEFINE_ALIAS -from .tensor.stat import std #DEFINE_ALIAS -from .tensor.stat import var #DEFINE_ALIAS +from .tensor.io import save #DEFINE_ALIAS +from .tensor.io import load #DEFINE_ALIAS +from .tensor.linalg import matmul #DEFINE_ALIAS +from .tensor.linalg import dot #DEFINE_ALIAS +# from .tensor.linalg import einsum #DEFINE_ALIAS +from .tensor.linalg import norm #DEFINE_ALIAS +from .tensor.linalg import transpose #DEFINE_ALIAS +from .tensor.linalg import dist #DEFINE_ALIAS +from .tensor.linalg import t #DEFINE_ALIAS +from .tensor.linalg import cross #DEFINE_ALIAS +from .tensor.linalg import cholesky #DEFINE_ALIAS +# from .tensor.linalg import tensordot #DEFINE_ALIAS +from .tensor.linalg import bmm #DEFINE_ALIAS from .tensor.logic import equal #DEFINE_ALIAS -# from .tensor.logic import greater_equal #DEFINE_ALIAS -# from .tensor.logic import greater_than #DEFINE_ALIAS -# from .tensor.logic import is_empty #DEFINE_ALIAS -# from .tensor.logic import isfinite #DEFINE_ALIAS -# from .tensor.logic import less_equal #DEFINE_ALIAS -# from .tensor.logic import less_than #DEFINE_ALIAS -# from .tensor.logic import logical_and #DEFINE_ALIAS -# from .tensor.logic import logical_not #DEFINE_ALIAS -# from .tensor.logic import logical_or #DEFINE_ALIAS -# from .tensor.logic import logical_xor #DEFINE_ALIAS -# from .tensor.logic import not_equal #DEFINE_ALIAS -# from .tensor.logic import reduce_all #DEFINE_ALIAS -# from .tensor.logic import reduce_any #DEFINE_ALIAS +from .tensor.logic import greater_equal #DEFINE_ALIAS +from .tensor.logic import greater_than #DEFINE_ALIAS +from .tensor.logic import is_empty #DEFINE_ALIAS +from .tensor.logic import isfinite #DEFINE_ALIAS +from .tensor.logic import less_equal #DEFINE_ALIAS +from .tensor.logic import less_than #DEFINE_ALIAS +from .tensor.logic import logical_and #DEFINE_ALIAS +from .tensor.logic import logical_not #DEFINE_ALIAS +from .tensor.logic import logical_or #DEFINE_ALIAS +from .tensor.logic import logical_xor #DEFINE_ALIAS +from .tensor.logic import not_equal #DEFINE_ALIAS +from .tensor.logic import reduce_all #DEFINE_ALIAS +from .tensor.logic import reduce_any #DEFINE_ALIAS from .tensor.logic import allclose #DEFINE_ALIAS from .tensor.logic import elementwise_equal #DEFINE_ALIAS -# from .tensor.logic import isnan #DEFINE_ALIAS -# from .tensor..tensor import Tensor #DEFINE_ALIAS -# from .tensor..tensor import LoDTensor #DEFINE_ALIAS -# from .tensor..tensor import LoDTensorArray #DEFINE_ALIAS -# from .tensor.random import gaussin #DEFINE_ALIAS -# from .tensor.random import uniform #DEFINE_ALIAS -# from .tensor.random import shuffle #DEFINE_ALIAS -from .tensor.random import randn #DEFINE_ALIAS -from .tensor.random import randperm -from .tensor.random import rand #DEFINE_ALIAS -from .tensor.random import randint #DEFINE_ALIAS -# from .tensor.math import abs #DEFINE_ALIAS -# from .tensor.math import acos #DEFINE_ALIAS -# from .tensor.math import asin #DEFINE_ALIAS +# from .tensor.logic import isnan #DEFINE_ALIAS +from .tensor.manipulation import cast #DEFINE_ALIAS +from .tensor.manipulation import concat #DEFINE_ALIAS +from .tensor.manipulation import expand #DEFINE_ALIAS +from .tensor.manipulation import expand_as #DEFINE_ALIAS +from .tensor.manipulation import flatten #DEFINE_ALIAS +from .tensor.manipulation import gather #DEFINE_ALIAS +# from .tensor.manipulation import gather_nd #DEFINE_ALIAS +from .tensor.manipulation import reshape #DEFINE_ALIAS +from .tensor.manipulation import reverse #DEFINE_ALIAS +from .tensor.manipulation import scatter #DEFINE_ALIAS +# from .tensor.manipulation import scatter_nd_add #DEFINE_ALIAS +# from .tensor.manipulation import scatter_nd #DEFINE_ALIAS +# from .tensor.manipulation import shard_index #DEFINE_ALIAS +from .tensor.manipulation import slice #DEFINE_ALIAS +from .tensor.manipulation import split #DEFINE_ALIAS +from .tensor.manipulation import squeeze #DEFINE_ALIAS +from .tensor.manipulation import stack #DEFINE_ALIAS +from .tensor.manipulation import strided_slice #DEFINE_ALIAS +from .tensor.manipulation import transpose #DEFINE_ALIAS +from .tensor.manipulation import unique #DEFINE_ALIAS +# from .tensor.manipulation import unique_with_counts #DEFINE_ALIAS +from .tensor.manipulation import unsqueeze #DEFINE_ALIAS +from .tensor.manipulation import unstack #DEFINE_ALIAS +from .tensor.manipulation import flip #DEFINE_ALIAS +# from .tensor.manipulation import unbind #DEFINE_ALIAS +from .tensor.manipulation import roll #DEFINE_ALIAS +from .tensor.math import abs #DEFINE_ALIAS +from .tensor.math import acos #DEFINE_ALIAS +from .tensor.math import asin #DEFINE_ALIAS from .tensor.math import atan #DEFINE_ALIAS -# from .tensor.math import ceil #DEFINE_ALIAS -# from .tensor.math import cos #DEFINE_ALIAS -# from .tensor.math import cumsum #DEFINE_ALIAS -# from .tensor.math import elementwise_add #DEFINE_ALIAS -# from .tensor.math import elementwise_div #DEFINE_ALIAS -# from .tensor.math import elementwise_floordiv #DEFINE_ALIAS -# from .tensor.math import elementwise_max #DEFINE_ALIAS -# from .tensor.math import elementwise_min #DEFINE_ALIAS -# from .tensor.math import elementwise_mod #DEFINE_ALIAS -# from .tensor.math import elementwise_mul #DEFINE_ALIAS -# from .tensor.math import elementwise_pow #DEFINE_ALIAS -# from .tensor.math import elementwise_sub #DEFINE_ALIAS -# from .tensor.math import exp #DEFINE_ALIAS -# from .tensor.math import floor #DEFINE_ALIAS -# from .tensor.math import increment #DEFINE_ALIAS -# from .tensor.math import log #DEFINE_ALIAS +from .tensor.math import ceil #DEFINE_ALIAS +from .tensor.math import cos #DEFINE_ALIAS +from .tensor.math import cumsum #DEFINE_ALIAS +from .tensor.math import elementwise_add #DEFINE_ALIAS +from .tensor.math import elementwise_div #DEFINE_ALIAS +from .tensor.math import elementwise_floordiv #DEFINE_ALIAS +from .tensor.math import elementwise_max #DEFINE_ALIAS +from .tensor.math import elementwise_min #DEFINE_ALIAS +from .tensor.math import elementwise_mod #DEFINE_ALIAS +from .tensor.math import elementwise_mul #DEFINE_ALIAS +from .tensor.math import elementwise_pow #DEFINE_ALIAS +from .tensor.math import elementwise_sub #DEFINE_ALIAS +from .tensor.math import exp #DEFINE_ALIAS +from .tensor.math import floor #DEFINE_ALIAS +# from .tensor.math import increment #DEFINE_ALIAS +from .tensor.math import log #DEFINE_ALIAS from .tensor.math import mul #DEFINE_ALIAS -# from .tensor.math import multiplex #DEFINE_ALIAS +# from .tensor.math import multiplex #DEFINE_ALIAS from .tensor.math import pow #DEFINE_ALIAS -# from .tensor.math import reciprocal #DEFINE_ALIAS -# from .tensor.math import reduce_max #DEFINE_ALIAS -# from .tensor.math import reduce_min #DEFINE_ALIAS -# from .tensor.math import reduce_prod #DEFINE_ALIAS -# from .tensor.math import reduce_sum #DEFINE_ALIAS -# from .tensor.math import round #DEFINE_ALIAS -# from .tensor.math import rsqrt #DEFINE_ALIAS -# from .tensor.math import scale #DEFINE_ALIAS -# from .tensor.math import sign #DEFINE_ALIAS +from .tensor.math import reciprocal #DEFINE_ALIAS +from .tensor.math import reduce_max #DEFINE_ALIAS +from .tensor.math import reduce_min #DEFINE_ALIAS +from .tensor.math import reduce_prod #DEFINE_ALIAS +from .tensor.math import reduce_sum #DEFINE_ALIAS +from .tensor.math import round #DEFINE_ALIAS +from .tensor.math import rsqrt #DEFINE_ALIAS +from .tensor.math import scale #DEFINE_ALIAS +from .tensor.math import sign #DEFINE_ALIAS from .tensor.math import sin #DEFINE_ALIAS from .tensor.math import sqrt #DEFINE_ALIAS -# from .tensor.math import square #DEFINE_ALIAS -# from .tensor.math import stanh #DEFINE_ALIAS +from .tensor.math import square #DEFINE_ALIAS +from .tensor.math import stanh #DEFINE_ALIAS from .tensor.math import sum #DEFINE_ALIAS -# from .tensor.math import sums #DEFINE_ALIAS +# from .tensor.math import sums #DEFINE_ALIAS from .tensor.math import tanh #DEFINE_ALIAS from .tensor.math import elementwise_sum #DEFINE_ALIAS from .tensor.math import max #DEFINE_ALIAS @@ -139,93 +165,38 @@ from .tensor.math import min #DEFINE_ALIAS from .tensor.math import mm #DEFINE_ALIAS from .tensor.math import div #DEFINE_ALIAS from .tensor.math import add #DEFINE_ALIAS -from .tensor.math import kron #DEFINE_ALIAS -# from .tensor.math import atan #DEFINE_ALIAS +from .tensor.math import atan #DEFINE_ALIAS from .tensor.math import logsumexp #DEFINE_ALIAS -# from .tensor.math import inverse #DEFINE_ALIAS +# from .tensor.math import inverse #DEFINE_ALIAS from .tensor.math import log1p #DEFINE_ALIAS -# from .tensor.math import erf #DEFINE_ALIAS +from .tensor.math import erf #DEFINE_ALIAS from .tensor.math import addcmul #DEFINE_ALIAS from .tensor.math import addmm #DEFINE_ALIAS from .tensor.math import clamp #DEFINE_ALIAS -# from .tensor.attribute import rank #DEFINE_ALIAS -# from .tensor.attribute import shape #DEFINE_ALIAS -# from .tensor.io import save #DEFINE_ALIAS -# from .tensor.io import load #DEFINE_ALIAS -from .tensor.linalg import matmul #DEFINE_ALIAS -from .tensor.linalg import bmm #DEFINE_ALIAS -from .tensor.linalg import dot #DEFINE_ALIAS -# from .tensor.linalg import einsum #DEFINE_ALIAS -from .tensor.linalg import norm #DEFINE_ALIAS -# from .tensor.linalg import transpose #DEFINE_ALIAS -from .tensor.linalg import dist #DEFINE_ALIAS -from .tensor.linalg import t #DEFINE_ALIAS -from .tensor.linalg import cross #DEFINE_ALIAS -from .tensor.linalg import cholesky #DEFINE_ALIAS -# from .tensor.linalg import .tensordot #DEFINE_ALIAS -# from .tensor.manipulation import cast #DEFINE_ALIAS -# from .tensor.manipulation import concat #DEFINE_ALIAS -# from .tensor.manipulation import expand #DEFINE_ALIAS -# from .tensor.manipulation import expand_as #DEFINE_ALIAS -# from .tensor.manipulation import flatten #DEFINE_ALIAS -from .tensor.manipulation import gather #DEFINE_ALIAS -# from .tensor.manipulation import gather_nd #DEFINE_ALIAS -# from .tensor.manipulation import reshape #DEFINE_ALIAS -# from .tensor.manipulation import reverse #DEFINE_ALIAS -# from .tensor.manipulation import scatter #DEFINE_ALIAS -# from .tensor.manipulation import scatter_nd_add #DEFINE_ALIAS -# from .tensor.manipulation import scatter_nd #DEFINE_ALIAS -# from .tensor.manipulation import shard_index #DEFINE_ALIAS -# from .tensor.manipulation import slice #DEFINE_ALIAS -from .tensor.manipulation import split #DEFINE_ALIAS -from .tensor.manipulation import squeeze #DEFINE_ALIAS -from .tensor.manipulation import stack #DEFINE_ALIAS -# from .tensor.manipulation import strided_slice #DEFINE_ALIAS -# from .tensor.manipulation import transpose #DEFINE_ALIAS -# from .tensor.manipulation import unique #DEFINE_ALIAS -# from .tensor.manipulation import unique_with_counts #DEFINE_ALIAS -from .tensor.manipulation import unsqueeze #DEFINE_ALIAS -# from .tensor.manipulation import unstack #DEFINE_ALIAS -from .tensor.manipulation import flip #DEFINE_ALIAS -# from .tensor.manipulation import unbind #DEFINE_ALIAS -from .tensor.manipulation import roll #DEFINE_ALIAS +from .tensor.math import kron #DEFINE_ALIAS +# from .tensor.random import gaussin #DEFINE_ALIAS +# from .tensor.random import uniform #DEFINE_ALIAS +from .tensor.random import shuffle #DEFINE_ALIAS +from .tensor.random import randn #DEFINE_ALIAS +from .tensor.random import rand #DEFINE_ALIAS +from .tensor.random import randint #DEFINE_ALIAS +from .tensor.random import randperm #DEFINE_ALIAS from .tensor.search import argmax #DEFINE_ALIAS -# from .tensor.search import argmin #DEFINE_ALIAS -# from .tensor.search import argsort #DEFINE_ALIAS -# from .tensor.search import has_inf #DEFINE_ALIAS -# from .tensor.search import has_nan #DEFINE_ALIAS -# from .tensor.search import masked_select #DEFINE_ALIAS -# from .tensor.search import topk #DEFINE_ALIAS +from .tensor.search import argmin #DEFINE_ALIAS +from .tensor.search import argsort #DEFINE_ALIAS +from .tensor.search import has_inf #DEFINE_ALIAS +from .tensor.search import has_nan #DEFINE_ALIAS +# from .tensor.search import masked_select #DEFINE_ALIAS +from .tensor.search import topk #DEFINE_ALIAS from .tensor.search import where #DEFINE_ALIAS from .tensor.search import index_select #DEFINE_ALIAS -from .tensor.search import index_sample #DEFINE_ALIAS from .tensor.search import nonzero #DEFINE_ALIAS from .tensor.search import sort #DEFINE_ALIAS -# from .framework.framework import set_default_dtype #DEFINE_ALIAS -# from .framework.framework import get_default_dtype #DEFINE_ALIAS -from .framework.random import manual_seed #DEFINE_ALIAS -# from .framework import append_backward #DEFINE_ALIAS -# from .framework import gradients #DEFINE_ALIAS -# from .framework import Executor #DEFINE_ALIAS -# from .framework import global_scope #DEFINE_ALIAS -# from .framework import scope_guard #DEFINE_ALIAS -# from .framework import BuildStrategy #DEFINE_ALIAS -# from .framework import CompiledProgram #DEFINE_ALIAS -# from .framework import default_main_program #DEFINE_ALIAS -# from .framework import default_startup_program #DEFINE_ALIAS -# from .framework import create_global_var #DEFINE_ALIAS -# from .framework import create_parameter #DEFINE_ALIAS -# from .framework import create_py_reader_by_data #DEFINE_ALIAS -# from .framework import Print #DEFINE_ALIAS -# from .framework import py_func #DEFINE_ALIAS -# from .framework import ExecutionStrategy #DEFINE_ALIAS -# from .framework import in_dygraph_mode #DEFINE_ALIAS -# from .framework import name_scope #DEFINE_ALIAS -# from .framework import ParallelExecutor #DEFINE_ALIAS -# from .framework import ParamAttr #DEFINE_ALIAS -# from .framework import Program #DEFINE_ALIAS -# from .framework import program_guard #DEFINE_ALIAS -# from .framework import Variable #DEFINE_ALIAS -# from .framework import WeightNormParamAttr #DEFINE_ALIAS -# from .framework import Model #DEFINE_ALIAS -# from .framework import Sequential #DEFINE_ALIAS +from .tensor.search import index_sample #DEFINE_ALIAS +from .tensor.stat import mean #DEFINE_ALIAS +from .tensor.stat import reduce_mean #DEFINE_ALIAS +from .tensor.stat import std #DEFINE_ALIAS +from .tensor.stat import var #DEFINE_ALIAS +# from .tensor.tensor import Tensor #DEFINE_ALIAS +# from .tensor.tensor import LoDTensor #DEFINE_ALIAS +# from .tensor.tensor import LoDTensorArray #DEFINE_ALIAS diff --git a/python/paddle/nn/__init__.py b/python/paddle/nn/__init__.py index 9c2e7c0f53..e20d902305 100644 --- a/python/paddle/nn/__init__.py +++ b/python/paddle/nn/__init__.py @@ -23,248 +23,75 @@ __all__ += norm.__all__ __all__ += extension.__all__ # TODO: define alias in nn directory -# from .clip import ErrorClipByValue #DEFINE_ALIAS -# from .clip import GradientClipByGlobalNorm #DEFINE_ALIAS -# from .clip import GradientClipByNorm #DEFINE_ALIAS -# from .clip import GradientClipByValue #DEFINE_ALIAS -# from .clip import set_gradient_clip #DEFINE_ALIAS -# from .clip import clip #DEFINE_ALIAS -# from .clip import clip_by_norm #DEFINE_ALIAS -# from .initalizer import Bilinear #DEFINE_ALIAS -# from .initalizer import Constant #DEFINE_ALIAS -# from .initalizer import MSRA #DEFINE_ALIAS -# from .initalizer import Normal #DEFINE_ALIAS -# from .initalizer import TruncatedNormal #DEFINE_ALIAS -# from .initalizer import Uniform #DEFINE_ALIAS -# from .initalizer import Xavier #DEFINE_ALIAS -# from .decode import BeamSearchDecoder #DEFINE_ALIAS -# from .decode import Decoder #DEFINE_ALIAS -# from .decode import beam_search #DEFINE_ALIAS -# from .decode import beam_search_decode #DEFINE_ALIAS -# from .decode import crf_decoding #DEFINE_ALIAS -# from .decode import ctc_greedy_decoder #DEFINE_ALIAS -# from .decode import dynamic_decode #DEFINE_ALIAS -# from .decode import gather_tree #DEFINE_ALIAS -# from .bin.conv import 0 #DEFINE_ALIAS -# from .control_flow import case #DEFINE_ALIAS -# from .control_flow import cond #DEFINE_ALIAS -# from .control_flow import DynamicRNN #DEFINE_ALIAS -# from .control_flow import StaticRNN #DEFINE_ALIAS -# from .control_flow import switch_case #DEFINE_ALIAS -# from .control_flow import while_loop #DEFINE_ALIAS -# from .control_flow import rnn #DEFINE_ALIAS -# from .layer.conv import Conv2D #DEFINE_ALIAS -# from .layer.conv import Conv2DTranspose #DEFINE_ALIAS -# from .layer.conv import Conv3D #DEFINE_ALIAS -# from .layer.conv import Conv3DTranspose #DEFINE_ALIAS -# from .layer.conv import TreeConv #DEFINE_ALIAS -# from .layer.conv import Conv1D #DEFINE_ALIAS -# from .layer.loss import NCELoss #DEFINE_ALIAS +# from .clip import ErrorClipByValue #DEFINE_ALIAS +from .clip import GradientClipByGlobalNorm #DEFINE_ALIAS +from .clip import GradientClipByNorm #DEFINE_ALIAS +from .clip import GradientClipByValue #DEFINE_ALIAS +# from .clip import set_gradient_clip #DEFINE_ALIAS +from .clip import clip #DEFINE_ALIAS +# from .clip import clip_by_norm #DEFINE_ALIAS +from .control_flow import case #DEFINE_ALIAS +from .control_flow import cond #DEFINE_ALIAS +# from .control_flow import DynamicRNN #DEFINE_ALIAS +# from .control_flow import StaticRNN #DEFINE_ALIAS +# from .control_flow import switch_case #DEFINE_ALIAS +from .control_flow import while_loop #DEFINE_ALIAS +# from .control_flow import rnn #DEFINE_ALIAS +# from .decode import BeamSearchDecoder #DEFINE_ALIAS +# from .decode import Decoder #DEFINE_ALIAS +from .decode import beam_search #DEFINE_ALIAS +from .decode import beam_search_decode #DEFINE_ALIAS +# from .decode import crf_decoding #DEFINE_ALIAS +# from .decode import ctc_greedy_decoder #DEFINE_ALIAS +# from .decode import dynamic_decode #DEFINE_ALIAS +# from .decode import gather_tree #DEFINE_ALIAS +# from .initalizer import Bilinear #DEFINE_ALIAS +# from .initalizer import Constant #DEFINE_ALIAS +# from .initalizer import MSRA #DEFINE_ALIAS +# from .initalizer import Normal #DEFINE_ALIAS +# from .initalizer import TruncatedNormal #DEFINE_ALIAS +# from .initalizer import Uniform #DEFINE_ALIAS +# from .initalizer import Xavier #DEFINE_ALIAS +from .input import data #DEFINE_ALIAS +# from .input import Input #DEFINE_ALIAS +# from .layer.activation import PReLU #DEFINE_ALIAS +from .layer.activation import ReLU #DEFINE_ALIAS +from .layer.activation import Sigmoid #DEFINE_ALIAS +# from .layer.activation import Softmax #DEFINE_ALIAS +from .layer.activation import LogSoftmax #DEFINE_ALIAS +from .layer.activation import HSigmoid #DEFINE_ALIAS +from .layer.common import BilinearTensorProduct #DEFINE_ALIAS +from .layer.common import Pool2D #DEFINE_ALIAS +from .layer.common import Embedding #DEFINE_ALIAS +from .layer.common import Linear #DEFINE_ALIAS +# from .layer.common import UpSample #DEFINE_ALIAS +from .layer.conv import Conv2D #DEFINE_ALIAS +from .layer.conv import Conv2DTranspose #DEFINE_ALIAS +from .layer.conv import Conv3D #DEFINE_ALIAS +from .layer.conv import Conv3DTranspose #DEFINE_ALIAS +# from .layer.conv import TreeConv #DEFINE_ALIAS +# from .layer.conv import Conv1D #DEFINE_ALIAS +from .layer.extension import RowConv #DEFINE_ALIAS +# from .layer.learning_rate import CosineDecay #DEFINE_ALIAS +# from .layer.learning_rate import ExponentialDecay #DEFINE_ALIAS +# from .layer.learning_rate import InverseTimeDecay #DEFINE_ALIAS +# from .layer.learning_rate import NaturalExpDecay #DEFINE_ALIAS +# from .layer.learning_rate import NoamDecay #DEFINE_ALIAS +# from .layer.learning_rate import PiecewiseDecay #DEFINE_ALIAS +# from .layer.learning_rate import PolynomialDecay #DEFINE_ALIAS +# from .layer.loss import NCELoss #DEFINE_ALIAS from .layer.loss import CrossEntropyLoss #DEFINE_ALIAS -# from .layer.loss import MSELoss #DEFINE_ALIAS +from .layer.loss import MSELoss #DEFINE_ALIAS from .layer.loss import L1Loss #DEFINE_ALIAS -from .layer import loss #DEFINE_ALIAS -from .layer import conv #DEFINE_ALIAS -from .layer.conv import Conv2D, Conv2DTranspose, Conv3D, Conv3DTranspose #DEFINE_ALIAS from .layer.loss import NLLLoss #DEFINE_ALIAS from .layer.loss import BCELoss #DEFINE_ALIAS -# from .layer.learning_rate import CosineDecay #DEFINE_ALIAS -# from .layer.learning_rate import ExponentialDecay #DEFINE_ALIAS -# from .layer.learning_rate import InverseTimeDecay #DEFINE_ALIAS -# from .layer.learning_rate import NaturalExpDecay #DEFINE_ALIAS -# from .layer.learning_rate import NoamDecay #DEFINE_ALIAS -# from .layer.learning_rate import PiecewiseDecay #DEFINE_ALIAS -# from .layer.learning_rate import PolynomialDecay #DEFINE_ALIAS -# from .layer.transformer import #DEFINE_ALIAS -# from .layer.norm import BatchNorm #DEFINE_ALIAS -# from .layer.norm import GroupNorm #DEFINE_ALIAS -# from .layer.norm import LayerNorm #DEFINE_ALIAS +from .layer.norm import BatchNorm #DEFINE_ALIAS +from .layer.norm import GroupNorm #DEFINE_ALIAS +from .layer.norm import LayerNorm #DEFINE_ALIAS +from .layer.norm import SpectralNorm #DEFINE_ALIAS from .layer.norm import InstanceNorm #DEFINE_ALIAS -# from .layer.norm import SpectralNorm #DEFINE_ALIAS -from .layer.activation import HSigmoid #DEFINE_ALIAS -# from .layer.activation import PReLU #DEFINE_ALIAS -from .layer.activation import ReLU #DEFINE_ALIAS -from .layer.activation import Sigmoid #DEFINE_ALIAS -# from .layer.activation import Softmax #DEFINE_ALIAS -# from .layer.activation import LogSoftmax #DEFINE_ALIAS -from .layer.extension import RowConv #DEFINE_ALIAS -from .layer.activation import LogSoftmax #DEFINE_ALIAS -# from .layer.rnn import RNNCell #DEFINE_ALIAS -# from .layer.rnn import GRUCell #DEFINE_ALIAS -# from .layer.rnn import LSTMCell #DEFINE_ALIAS -# from .layer.common import BilinearTensorProduct #DEFINE_ALIAS -# from .layer.common import Pool2D #DEFINE_ALIAS -# from .layer.common import Embedding #DEFINE_ALIAS -# from .layer.common import Linear #DEFINE_ALIAS -# from .layer.common import UpSample #DEFINE_ALIAS -from .functional.conv import conv2d #DEFINE_ALIAS -from .functional.conv import conv2d_transpose #DEFINE_ALIAS -from .functional.conv import conv3d #DEFINE_ALIAS -from .functional.conv import conv3d_transpose #DEFINE_ALIAS -# from .functional.loss import bpr_loss #DEFINE_ALIAS -# from .functional.loss import center_loss #DEFINE_ALIAS -# from .functional.loss import cross_entropy #DEFINE_ALIAS -# from .functional.loss import dice_loss #DEFINE_ALIAS -# from .functional.loss import edit_distance #DEFINE_ALIAS -# from .functional.loss import huber_loss #DEFINE_ALIAS -# from .functional.loss import iou_similarity #DEFINE_ALIAS -# from .functional.loss import kldiv_loss #DEFINE_ALIAS -# from .functional.loss import log_loss #DEFINE_ALIAS -# from .functional.loss import margin_rank_loss #DEFINE_ALIAS -# from .functional.loss import mse_loss #DEFINE_ALIAS -# from .functional.loss import nce #DEFINE_ALIAS -# from .functional.loss import npair_loss #DEFINE_ALIAS -# from .functional.loss import rank_loss #DEFINE_ALIAS -# from .functional.loss import sampled_softmax_with_cross_entropy #DEFINE_ALIAS -# from .functional.loss import sigmoid_cross_entropy_with_logits #DEFINE_ALIAS -# from .functional.loss import sigmoid_focal_loss #DEFINE_ALIAS -# from .functional.loss import smooth_l1 #DEFINE_ALIAS -# from .functional.loss import softmax_with_cross_entropy #DEFINE_ALIAS -# from .functional.loss import square_error_cost #DEFINE_ALIAS -# from .functional.loss import ssd_loss #DEFINE_ALIAS -# from .functional.loss import teacher_student_sigmoid_loss #DEFINE_ALIAS -# from .functional.learning_rate import cosine_decay #DEFINE_ALIAS -# from .functional.learning_rate import exponential_decay #DEFINE_ALIAS -# from .functional.learning_rate import inverse_time_decay #DEFINE_ALIAS -# from .functional.learning_rate import natural_exp_decay #DEFINE_ALIAS -# from .functional.learning_rate import noam_decay #DEFINE_ALIAS -# from .functional.learning_rate import piecewise_decay #DEFINE_ALIAS -# from .functional.learning_rate import polynomial_decay #DEFINE_ALIAS -# from .functional.learning_rate import linear_lr_warmup #DEFINE_ALIAS -# from .functional.transformer import #DEFINE_ALIAS -# from .functional.pooling import pool2d #DEFINE_ALIAS -# from .functional.pooling import pool3d #DEFINE_ALIAS -# from .functional.pooling import adaptive_pool2d #DEFINE_ALIAS -# from .functional.pooling import adaptive_pool3d #DEFINE_ALIAS -# from .functional.norm import batch_norm #DEFINE_ALIAS -# from .functional.norm import data_norm #DEFINE_ALIAS -# from .functional.norm import group_norm #DEFINE_ALIAS -# from .functional.norm import instance_norm #DEFINE_ALIAS -# from .functional.norm import l2_normalize #DEFINE_ALIAS -# from .functional.norm import layer_norm #DEFINE_ALIAS -# from .functional.norm import lrn #DEFINE_ALIAS -# from .functional.norm import spectral_norm #DEFINE_ALIAS -# from .functional.vision import affine_channel #DEFINE_ALIAS -# from .functional.vision import affine_grid #DEFINE_ALIAS -# from .functional.vision import anchor_generator #DEFINE_ALIAS -# from .functional.vision import bipartite_match #DEFINE_ALIAS -# from .functional.vision import box_clip #DEFINE_ALIAS -# from .functional.vision import box_coder #DEFINE_ALIAS -# from .functional.vision import box_decoder_and_assign #DEFINE_ALIAS -# from .functional.vision import collect_fpn_proposals #DEFINE_ALIAS -# from .functional.vision import deformable_conv #DEFINE_ALIAS -# from .functional.vision import deformable_roi_pooling #DEFINE_ALIAS -# from .functional.vision import density_prior_box #DEFINE_ALIAS -# from .functional.vision import detection_output #DEFINE_ALIAS -# from .functional.vision import distribute_fpn_proposals #DEFINE_ALIAS -# from .functional.vision import fsp_matrix #DEFINE_ALIAS -# from .functional.vision import generate_mask_labels #DEFINE_ALIAS -# from .functional.vision import generate_proposal_labels #DEFINE_ALIAS -# from .functional.vision import generate_proposals #DEFINE_ALIAS -# from .functional.vision import grid_sampler #DEFINE_ALIAS -# from .functional.vision import image_resize #DEFINE_ALIAS -# from .functional.vision import image_resize_short #DEFINE_ALIAS -# from .functional.vision import multi_box_head #DEFINE_ALIAS -# from .functional.vision import pixel_shuffle #DEFINE_ALIAS -# from .functional.vision import prior_box #DEFINE_ALIAS -# from .functional.vision import prroi_pool #DEFINE_ALIAS -# from .functional.vision import psroi_pool #DEFINE_ALIAS -# from .functional.vision import resize_bilinear #DEFINE_ALIAS -# from .functional.vision import resize_nearest #DEFINE_ALIAS -# from .functional.vision import resize_trilinear #DEFINE_ALIAS -# from .functional.vision import retinanet_detection_output #DEFINE_ALIAS -# from .functional.vision import retinanet_target_assign #DEFINE_ALIAS -# from .functional.vision import roi_align #DEFINE_ALIAS -# from .functional.vision import roi_perspective_transform #DEFINE_ALIAS -# from .functional.vision import roi_pool #DEFINE_ALIAS -# from .functional.vision import shuffle_channel #DEFINE_ALIAS -# from .functional.vision import space_to_depth #DEFINE_ALIAS -# from .functional.vision import yolo_box #DEFINE_ALIAS -# from .functional.vision import yolov3_loss #DEFINE_ALIAS -# from .functional.activation import brelu #DEFINE_ALIAS -# from .functional.activation import elu #DEFINE_ALIAS -# from .functional.activation import erf #DEFINE_ALIAS -# from .functional.activation import gelu #DEFINE_ALIAS -# from .functional.activation import hard_shrink #DEFINE_ALIAS -# from .functional.activation import hard_sigmoid #DEFINE_ALIAS -# from .functional.activation import hard_swish #DEFINE_ALIAS -from .functional.activation import hsigmoid #DEFINE_ALIAS -# from .functional.activation import leaky_relu #DEFINE_ALIAS -# from .functional.activation import logsigmoid #DEFINE_ALIAS -# from .functional.activation import maxout #DEFINE_ALIAS -# from .functional.activation import prelu #DEFINE_ALIAS -from .functional.activation import relu #DEFINE_ALIAS -# from .functional.activation import relu6 #DEFINE_ALIAS -# from .functional.activation import selu #DEFINE_ALIAS -from .functional.activation import sigmoid #DEFINE_ALIAS -# from .functional.activation import soft_relu #DEFINE_ALIAS -# from .functional.activation import softmax #DEFINE_ALIAS -# from .functional.activation import softplus #DEFINE_ALIAS -# from .functional.activation import softshrink #DEFINE_ALIAS -# from .functional.activation import softsign #DEFINE_ALIAS -# from .functional.activation import swish #DEFINE_ALIAS -# from .functional.activation import tanh_shrink #DEFINE_ALIAS -# from .functional.activation import thresholded_relu #DEFINE_ALIAS -from .functional.activation import log_softmax #DEFINE_ALIAS -# from .functional.extension import add_position_encoding #DEFINE_ALIAS -# from .functional.extension import autoincreased_step_counter #DEFINE_ALIAS -# from .functional.extension import continuous_value_model #DEFINE_ALIAS -# from .functional.extension import filter_by_instag #DEFINE_ALIAS -# from .functional.extension import linear_chain_crf #DEFINE_ALIAS -# from .functional.extension import merge_selected_rows #DEFINE_ALIAS -# from .functional.extension import multiclass_nms #DEFINE_ALIAS -# from .functional.extension import polygon_box_transform #DEFINE_ALIAS -# from .functional.extension import random_crop #DEFINE_ALIAS -from .functional.extension import row_conv #DEFINE_ALIAS -# from .functional.extension import rpn_target_assign #DEFINE_ALIAS -# from .functional.extension import similarity_focus #DEFINE_ALIAS -# from .functional.extension import target_assign #DEFINE_ALIAS -# from .functional.extension import temporal_shift #DEFINE_ALIAS -# from .functional.extension import warpctc #DEFINE_ALIAS -from .functional.extension import diag_embed #DEFINE_ALIAS -# from .functional.rnn import gru_unit #DEFINE_ALIAS -# from .functional.rnn import lstm #DEFINE_ALIAS -# from .functional.rnn import lstm_unit #DEFINE_ALIAS -# from .functional.lod import sequence_concat #DEFINE_ALIAS -# from .functional.lod import sequence_conv #DEFINE_ALIAS -# from .functional.lod import sequence_enumerate #DEFINE_ALIAS -# from .functional.lod import sequence_expand_as #DEFINE_ALIAS -# from .functional.lod import sequence_expand #DEFINE_ALIAS -# from .functional.lod import sequence_first_step #DEFINE_ALIAS -# from .functional.lod import sequence_last_step #DEFINE_ALIAS -# from .functional.lod import sequence_mask #DEFINE_ALIAS -# from .functional.lod import sequence_pad #DEFINE_ALIAS -# from .functional.lod import sequence_pool #DEFINE_ALIAS -# from .functional.lod import sequence_reshape #DEFINE_ALIAS -# from .functional.lod import sequence_reverse #DEFINE_ALIAS -# from .functional.lod import sequence_scatter #DEFINE_ALIAS -# from .functional.lod import sequence_slice #DEFINE_ALIAS -# from .functional.lod import sequence_softmax #DEFINE_ALIAS -# from .functional.lod import sequence_unpad #DEFINE_ALIAS -# from .functional.lod import array_length #DEFINE_ALIAS -# from .functional.lod import array_read #DEFINE_ALIAS -# from .functional.lod import array_write #DEFINE_ALIAS -# from .functional.lod import create_array #DEFINE_ALIAS -# from .functional.lod import hash #DEFINE_ALIAS -# from .functional.lod import im2sequence #DEFINE_ALIAS -# from .functional.lod import lod_append #DEFINE_ALIAS -# from .functional.lod import lod_reset #DEFINE_ALIAS -# from .functional.lod import reorder_lod_tensor_by_rank #DEFINE_ALIAS -# from .functional.lod import tensor_array_to_tensor #DEFINE_ALIAS -# from .functional.lod import dynamic_gru #DEFINE_ALIAS -# from .functional.lod import dynamic_lstm #DEFINE_ALIAS -# from .functional.lod import dynamic_lstmp #DEFINE_ALIAS -# from .functional.common import dropout #DEFINE_ALIAS -# from .functional.common import embedding #DEFINE_ALIAS -# from .functional.common import fc #DEFINE_ALIAS -# from .functional.common import label_smooth #DEFINE_ALIAS -# from .functional.common import one_hot #DEFINE_ALIAS -# from .functional.common import pad #DEFINE_ALIAS -# from .functional.common import pad_constant_like #DEFINE_ALIAS -# from .functional.common import pad2d #DEFINE_ALIAS -# from .functional.common import unfold #DEFINE_ALIAS -# from .functional.common import bilinear_tensor_product #DEFINE_ALIAS -# from .functional.common import assign #DEFINE_ALIAS -# from .functional.common import interpolate #DEFINE_ALIAS -# from .input import data #DEFINE_ALIAS -# from .input import Input #DEFINE_ALIAS +# from .layer.rnn import RNNCell #DEFINE_ALIAS +# from .layer.rnn import GRUCell #DEFINE_ALIAS +# from .layer.rnn import LSTMCell #DEFINE_ALIAS +from .layer import loss #DEFINE_ALIAS +from .layer import conv #DEFINE_ALIAS diff --git a/python/paddle/nn/clip.py b/python/paddle/nn/clip.py index 970135e740..7d528ce153 100644 --- a/python/paddle/nn/clip.py +++ b/python/paddle/nn/clip.py @@ -13,10 +13,17 @@ # limitations under the License. # TODO: define the functions to clip gradient of parameter -# __all__ = ['ErrorClipByValue', -# 'GradientClipByGlobalNorm', -# 'GradientClipByNorm', -# 'GradientClipByValue', -# 'set_gradient_clip', -# 'clip', -# 'clip_by_norm'] +from ..fluid.clip import GradientClipByGlobalNorm #DEFINE_ALIAS +from ..fluid.clip import GradientClipByNorm #DEFINE_ALIAS +from ..fluid.clip import GradientClipByValue #DEFINE_ALIAS +from ..fluid.layers import clip #DEFINE_ALIAS + +__all__ = [ + # 'ErrorClipByValue', + 'GradientClipByGlobalNorm', + 'GradientClipByNorm', + 'GradientClipByValue', + # 'set_gradient_clip', + 'clip', + # 'clip_by_norm' +] diff --git a/python/paddle/nn/control_flow.py b/python/paddle/nn/control_flow.py index 4629dc633c..7526ee1aba 100644 --- a/python/paddle/nn/control_flow.py +++ b/python/paddle/nn/control_flow.py @@ -13,10 +13,16 @@ # limitations under the License. # TODO: define the control flow api -# __all__ = ['case', -# 'cond', -# 'DynamicRNN', -# 'StaticRNN', -# 'switch_case', -# 'while_loop', -# 'rnn'] +from ..fluid.layers import case #DEFINE_ALIAS +from ..fluid.layers import cond #DEFINE_ALIAS +from ..fluid.layers import while_loop #DEFINE_ALIAS + +__all__ = [ + 'case', + 'cond', + # 'DynamicRNN', + # 'StaticRNN', + # 'switch_case', + 'while_loop', + # 'rnn' +] diff --git a/python/paddle/nn/decode.py b/python/paddle/nn/decode.py index 84984936cb..ad36021fa5 100644 --- a/python/paddle/nn/decode.py +++ b/python/paddle/nn/decode.py @@ -13,11 +13,16 @@ # limitations under the License. # TODO: define api to implement decoding algorithm -# __all__ = ['BeamSearchDecoder', -# 'Decoder', -# 'beam_search', -# 'beam_search_decode', -# 'crf_decoding', -# 'ctc_greedy_decoder', -# 'dynamic_decode', -# 'gather_tree'] +from ..fluid.layers import beam_search #DEFINE_ALIAS +from ..fluid.layers import beam_search_decode #DEFINE_ALIAS + +__all__ = [ + # 'BeamSearchDecoder', + # 'Decoder', + 'beam_search', + 'beam_search_decode', + # 'crf_decoding', + # 'ctc_greedy_decoder', + # 'dynamic_decode', + # 'gather_tree' +] diff --git a/python/paddle/nn/functional/__init__.py b/python/paddle/nn/functional/__init__.py index 730eaca234..c02e189368 100644 --- a/python/paddle/nn/functional/__init__.py +++ b/python/paddle/nn/functional/__init__.py @@ -19,178 +19,177 @@ __all__ = [] # TODO: define alias in functional directory from . import conv __all__ += conv.__all__ -from .conv import conv2d #DEFINE_ALIAS -from .conv import conv2d_transpose #DEFINE_ALIAS -from .conv import conv3d #DEFINE_ALIAS -from .conv import conv3d_transpose #DEFINE_ALIAS -# from .loss import bpr_loss #DEFINE_ALIAS -# from .loss import center_loss #DEFINE_ALIAS -# from .loss import cross_entropy #DEFINE_ALIAS -# from .loss import dice_loss #DEFINE_ALIAS -# from .loss import edit_distance #DEFINE_ALIAS -# from .loss import huber_loss #DEFINE_ALIAS -# from .loss import iou_similarity #DEFINE_ALIAS -# from .loss import kldiv_loss #DEFINE_ALIAS -# from .loss import log_loss #DEFINE_ALIAS -# from .loss import margin_rank_loss #DEFINE_ALIAS -# from .loss import mse_loss #DEFINE_ALIAS -# from .loss import nce #DEFINE_ALIAS -# from .loss import npair_loss #DEFINE_ALIAS -# from .loss import rank_loss #DEFINE_ALIAS -# from .loss import sampled_softmax_with_cross_entropy #DEFINE_ALIAS -# from .loss import sigmoid_cross_entropy_with_logits #DEFINE_ALIAS -# from .loss import sigmoid_focal_loss #DEFINE_ALIAS -# from .loss import smooth_l1 #DEFINE_ALIAS -# from .loss import softmax_with_cross_entropy #DEFINE_ALIAS -# from .loss import square_error_cost #DEFINE_ALIAS -# from .loss import ssd_loss #DEFINE_ALIAS -# from .loss import teacher_student_sigmoid_loss #DEFINE_ALIAS -# from .learning_rate import cosine_decay #DEFINE_ALIAS -# from .learning_rate import exponential_decay #DEFINE_ALIAS -# from .learning_rate import inverse_time_decay #DEFINE_ALIAS -# from .learning_rate import natural_exp_decay #DEFINE_ALIAS -# from .learning_rate import noam_decay #DEFINE_ALIAS -# from .learning_rate import piecewise_decay #DEFINE_ALIAS -# from .learning_rate import polynomial_decay #DEFINE_ALIAS -# from .learning_rate import linear_lr_warmup #DEFINE_ALIAS -# from .transformer import #DEFINE_ALIAS -# from .pooling import pool2d #DEFINE_ALIAS -# from .pooling import pool3d #DEFINE_ALIAS -# from .pooling import adaptive_pool2d #DEFINE_ALIAS -# from .pooling import adaptive_pool3d #DEFINE_ALIAS -# from .norm import batch_norm #DEFINE_ALIAS -# from .norm import data_norm #DEFINE_ALIAS -# from .norm import group_norm #DEFINE_ALIAS -# from .norm import instance_norm #DEFINE_ALIAS -# from .norm import l2_normalize #DEFINE_ALIAS -# from .norm import layer_norm #DEFINE_ALIAS -# from .norm import lrn #DEFINE_ALIAS -# from .norm import spectral_norm #DEFINE_ALIAS -# from .vision import affine_channel #DEFINE_ALIAS -# from .vision import affine_grid #DEFINE_ALIAS -# from .vision import anchor_generator #DEFINE_ALIAS -# from .vision import bipartite_match #DEFINE_ALIAS -# from .vision import box_clip #DEFINE_ALIAS -# from .vision import box_coder #DEFINE_ALIAS -# from .vision import box_decoder_and_assign #DEFINE_ALIAS -# from .vision import collect_fpn_proposals #DEFINE_ALIAS -# from .vision import deformable_conv #DEFINE_ALIAS -# from .vision import deformable_roi_pooling #DEFINE_ALIAS -# from .vision import density_prior_box #DEFINE_ALIAS -# from .vision import detection_output #DEFINE_ALIAS -# from .vision import distribute_fpn_proposals #DEFINE_ALIAS -# from .vision import fsp_matrix #DEFINE_ALIAS -# from .vision import generate_mask_labels #DEFINE_ALIAS -# from .vision import generate_proposal_labels #DEFINE_ALIAS -# from .vision import generate_proposals #DEFINE_ALIAS -# from .vision import grid_sampler #DEFINE_ALIAS -# from .vision import image_resize #DEFINE_ALIAS -# from .vision import image_resize_short #DEFINE_ALIAS -# from .vision import multi_box_head #DEFINE_ALIAS -# from .vision import pixel_shuffle #DEFINE_ALIAS -# from .vision import prior_box #DEFINE_ALIAS -# from .vision import prroi_pool #DEFINE_ALIAS -# from .vision import psroi_pool #DEFINE_ALIAS -# from .vision import resize_bilinear #DEFINE_ALIAS -# from .vision import resize_nearest #DEFINE_ALIAS -# from .vision import resize_trilinear #DEFINE_ALIAS -# from .vision import retinanet_detection_output #DEFINE_ALIAS -# from .vision import retinanet_target_assign #DEFINE_ALIAS -# from .vision import roi_align #DEFINE_ALIAS -# from .vision import roi_perspective_transform #DEFINE_ALIAS -# from .vision import roi_pool #DEFINE_ALIAS -# from .vision import shuffle_channel #DEFINE_ALIAS -# from .vision import space_to_depth #DEFINE_ALIAS -# from .vision import yolo_box #DEFINE_ALIAS -# from .vision import yolov3_loss #DEFINE_ALIAS from . import activation __all__ += activation.__all__ -# from .activation import brelu #DEFINE_ALIAS -# from .activation import elu #DEFINE_ALIAS -# from .activation import erf #DEFINE_ALIAS -# from .activation import gelu #DEFINE_ALIAS -# from .activation import hard_shrink #DEFINE_ALIAS -# from .activation import hard_sigmoid #DEFINE_ALIAS -# from .activation import hard_swish #DEFINE_ALIAS +from . import extension +__all__ += extension.__all__ +from . import common +__all__ += common.__all__ +from .activation import brelu #DEFINE_ALIAS +from .activation import elu #DEFINE_ALIAS +from .activation import erf #DEFINE_ALIAS +from .activation import gelu #DEFINE_ALIAS +from .activation import hard_shrink #DEFINE_ALIAS +from .activation import hard_sigmoid #DEFINE_ALIAS +from .activation import hard_swish #DEFINE_ALIAS from .activation import hsigmoid #DEFINE_ALIAS -# from .activation import leaky_relu #DEFINE_ALIAS -# from .activation import logsigmoid #DEFINE_ALIAS -# from .activation import maxout #DEFINE_ALIAS -# from .activation import prelu #DEFINE_ALIAS +from .activation import leaky_relu #DEFINE_ALIAS +from .activation import logsigmoid #DEFINE_ALIAS +from .activation import maxout #DEFINE_ALIAS +# from .activation import prelu #DEFINE_ALIAS from .activation import relu #DEFINE_ALIAS -# from .activation import relu6 #DEFINE_ALIAS -# from .activation import selu #DEFINE_ALIAS +from .activation import relu6 #DEFINE_ALIAS +from .activation import selu #DEFINE_ALIAS from .activation import sigmoid #DEFINE_ALIAS -# from .activation import soft_relu #DEFINE_ALIAS -# from .activation import softmax #DEFINE_ALIAS -# from .activation import softplus #DEFINE_ALIAS -# from .activation import softshrink #DEFINE_ALIAS -# from .activation import softsign #DEFINE_ALIAS -# from .activation import swish #DEFINE_ALIAS -# from .activation import tanh_shrink #DEFINE_ALIAS -# from .activation import thresholded_relu #DEFINE_ALIAS +from .activation import soft_relu #DEFINE_ALIAS +from .activation import softmax #DEFINE_ALIAS +from .activation import softplus #DEFINE_ALIAS +from .activation import softshrink #DEFINE_ALIAS +from .activation import softsign #DEFINE_ALIAS +from .activation import swish #DEFINE_ALIAS +from .activation import tanh_shrink #DEFINE_ALIAS +from .activation import thresholded_relu #DEFINE_ALIAS from .activation import log_softmax #DEFINE_ALIAS -from . import extension -__all__ += extension.__all__ -# from .extension import add_position_encoding #DEFINE_ALIAS -# from .extension import autoincreased_step_counter #DEFINE_ALIAS -# from .extension import continuous_value_model #DEFINE_ALIAS -# from .extension import filter_by_instag #DEFINE_ALIAS -# from .extension import linear_chain_crf #DEFINE_ALIAS -# from .extension import merge_selected_rows #DEFINE_ALIAS -# from .extension import multiclass_nms #DEFINE_ALIAS -# from .extension import polygon_box_transform #DEFINE_ALIAS -# from .extension import random_crop #DEFINE_ALIAS +from .common import dropout #DEFINE_ALIAS +# from .common import embedding #DEFINE_ALIAS +# from .common import fc #DEFINE_ALIAS +from .common import label_smooth #DEFINE_ALIAS +from .common import one_hot #DEFINE_ALIAS +from .common import pad #DEFINE_ALIAS +# from .common import pad_constant_like #DEFINE_ALIAS +from .common import pad2d #DEFINE_ALIAS +from .common import unfold #DEFINE_ALIAS +# from .common import bilinear_tensor_product #DEFINE_ALIAS +from .common import assign #DEFINE_ALIAS +from .common import interpolate #DEFINE_ALIAS +from .conv import conv2d #DEFINE_ALIAS +from .conv import conv2d_transpose #DEFINE_ALIAS +from .conv import conv3d #DEFINE_ALIAS +from .conv import conv3d_transpose #DEFINE_ALIAS +from .extension import add_position_encoding #DEFINE_ALIAS +# from .extension import autoincreased_step_counter #DEFINE_ALIAS +# from .extension import continuous_value_model #DEFINE_ALIAS +# from .extension import filter_by_instag #DEFINE_ALIAS +# from .extension import linear_chain_crf #DEFINE_ALIAS +# from .extension import merge_selected_rows #DEFINE_ALIAS +from .extension import multiclass_nms #DEFINE_ALIAS +# from .extension import polygon_box_transform #DEFINE_ALIAS +# from .extension import random_crop #DEFINE_ALIAS from .extension import row_conv #DEFINE_ALIAS -# from .extension import rpn_target_assign #DEFINE_ALIAS -# from .extension import similarity_focus #DEFINE_ALIAS -# from .extension import target_assign #DEFINE_ALIAS -# from .extension import temporal_shift #DEFINE_ALIAS -# from .extension import warpctc #DEFINE_ALIAS +# from .extension import rpn_target_assign #DEFINE_ALIAS +# from .extension import similarity_focus #DEFINE_ALIAS +from .extension import target_assign #DEFINE_ALIAS +from .extension import temporal_shift #DEFINE_ALIAS +# from .extension import warpctc #DEFINE_ALIAS from .extension import diag_embed #DEFINE_ALIAS -# from .rnn import gru_unit #DEFINE_ALIAS -# from .rnn import lstm #DEFINE_ALIAS -# from .rnn import lstm_unit #DEFINE_ALIAS -# from .lod import sequence_concat #DEFINE_ALIAS -# from .lod import sequence_conv #DEFINE_ALIAS -# from .lod import sequence_enumerate #DEFINE_ALIAS -# from .lod import sequence_expand_as #DEFINE_ALIAS -# from .lod import sequence_expand #DEFINE_ALIAS -# from .lod import sequence_first_step #DEFINE_ALIAS -# from .lod import sequence_last_step #DEFINE_ALIAS -# from .lod import sequence_mask #DEFINE_ALIAS -# from .lod import sequence_pad #DEFINE_ALIAS -# from .lod import sequence_pool #DEFINE_ALIAS -# from .lod import sequence_reshape #DEFINE_ALIAS -# from .lod import sequence_reverse #DEFINE_ALIAS -# from .lod import sequence_scatter #DEFINE_ALIAS -# from .lod import sequence_slice #DEFINE_ALIAS -# from .lod import sequence_softmax #DEFINE_ALIAS -# from .lod import sequence_unpad #DEFINE_ALIAS -# from .lod import array_length #DEFINE_ALIAS -# from .lod import array_read #DEFINE_ALIAS -# from .lod import array_write #DEFINE_ALIAS -# from .lod import create_array #DEFINE_ALIAS -# from .lod import hash #DEFINE_ALIAS -# from .lod import im2sequence #DEFINE_ALIAS -# from .lod import lod_append #DEFINE_ALIAS -# from .lod import lod_reset #DEFINE_ALIAS -# from .lod import reorder_lod_tensor_by_rank #DEFINE_ALIAS -# from .lod import tensor_array_to_tensor #DEFINE_ALIAS -# from .lod import dynamic_gru #DEFINE_ALIAS -# from .lod import dynamic_lstm #DEFINE_ALIAS -# from .lod import dynamic_lstmp #DEFINE_ALIAS -from . import common -__all__ += common.__all__ -# from .common import dropout #DEFINE_ALIAS -# from .common import embedding #DEFINE_ALIAS -# from .common import fc #DEFINE_ALIAS -# from .common import label_smooth #DEFINE_ALIAS -# from .common import one_hot #DEFINE_ALIAS -# from .common import pad #DEFINE_ALIAS -# from .common import pad_constant_like #DEFINE_ALIAS -# from .common import pad2d #DEFINE_ALIAS -# from .common import unfold #DEFINE_ALIAS -# from .common import bilinear_tensor_product #DEFINE_ALIAS -# from .common import assign #DEFINE_ALIAS -from .common import interpolate #DEFINE_ALIAS +from .learning_rate import cosine_decay #DEFINE_ALIAS +from .learning_rate import exponential_decay #DEFINE_ALIAS +from .learning_rate import inverse_time_decay #DEFINE_ALIAS +from .learning_rate import natural_exp_decay #DEFINE_ALIAS +from .learning_rate import noam_decay #DEFINE_ALIAS +from .learning_rate import piecewise_decay #DEFINE_ALIAS +from .learning_rate import polynomial_decay #DEFINE_ALIAS +from .learning_rate import linear_lr_warmup #DEFINE_ALIAS +# from .lod import sequence_concat #DEFINE_ALIAS +# from .lod import sequence_conv #DEFINE_ALIAS +# from .lod import sequence_enumerate #DEFINE_ALIAS +# from .lod import sequence_expand_as #DEFINE_ALIAS +# from .lod import sequence_expand #DEFINE_ALIAS +# from .lod import sequence_first_step #DEFINE_ALIAS +# from .lod import sequence_last_step #DEFINE_ALIAS +# from .lod import sequence_mask #DEFINE_ALIAS +# from .lod import sequence_pad #DEFINE_ALIAS +# from .lod import sequence_pool #DEFINE_ALIAS +# from .lod import sequence_reshape #DEFINE_ALIAS +# from .lod import sequence_reverse #DEFINE_ALIAS +# from .lod import sequence_scatter #DEFINE_ALIAS +# from .lod import sequence_slice #DEFINE_ALIAS +# from .lod import sequence_softmax #DEFINE_ALIAS +# from .lod import sequence_unpad #DEFINE_ALIAS +# from .lod import array_length #DEFINE_ALIAS +# from .lod import array_read #DEFINE_ALIAS +# from .lod import array_write #DEFINE_ALIAS +# from .lod import create_array #DEFINE_ALIAS +from .lod import hash #DEFINE_ALIAS +# from .lod import im2sequence #DEFINE_ALIAS +# from .lod import lod_append #DEFINE_ALIAS +# from .lod import lod_reset #DEFINE_ALIAS +# from .lod import reorder_lod_tensor_by_rank #DEFINE_ALIAS +# from .lod import tensor_array_to_tensor #DEFINE_ALIAS +# from .lod import dynamic_gru #DEFINE_ALIAS +# from .lod import dynamic_lstm #DEFINE_ALIAS +# from .lod import dynamic_lstmp #DEFINE_ALIAS +from .loss import bpr_loss #DEFINE_ALIAS +from .loss import center_loss #DEFINE_ALIAS +from .loss import cross_entropy #DEFINE_ALIAS +from .loss import dice_loss #DEFINE_ALIAS +# from .loss import edit_distance #DEFINE_ALIAS +# from .loss import huber_loss #DEFINE_ALIAS +from .loss import iou_similarity #DEFINE_ALIAS +from .loss import kldiv_loss #DEFINE_ALIAS +from .loss import log_loss #DEFINE_ALIAS +# from .loss import margin_rank_loss #DEFINE_ALIAS +from .loss import mse_loss #DEFINE_ALIAS +# from .loss import nce #DEFINE_ALIAS +from .loss import npair_loss #DEFINE_ALIAS +from .loss import rank_loss #DEFINE_ALIAS +# from .loss import sampled_softmax_with_cross_entropy #DEFINE_ALIAS +from .loss import sigmoid_cross_entropy_with_logits #DEFINE_ALIAS +from .loss import sigmoid_focal_loss #DEFINE_ALIAS +from .loss import smooth_l1 #DEFINE_ALIAS +from .loss import softmax_with_cross_entropy #DEFINE_ALIAS +from .loss import square_error_cost #DEFINE_ALIAS +from .loss import ssd_loss #DEFINE_ALIAS +from .loss import teacher_student_sigmoid_loss #DEFINE_ALIAS +# from .norm import batch_norm #DEFINE_ALIAS +# from .norm import data_norm #DEFINE_ALIAS +# from .norm import group_norm #DEFINE_ALIAS +# from .norm import instance_norm #DEFINE_ALIAS +from .norm import l2_normalize #DEFINE_ALIAS +# from .norm import layer_norm #DEFINE_ALIAS +from .norm import lrn #DEFINE_ALIAS +# from .norm import spectral_norm #DEFINE_ALIAS +from .pooling import pool2d #DEFINE_ALIAS +from .pooling import pool3d #DEFINE_ALIAS +from .pooling import adaptive_pool2d #DEFINE_ALIAS +from .pooling import adaptive_pool3d #DEFINE_ALIAS +# from .rnn import gru_unit #DEFINE_ALIAS +# from .rnn import lstm #DEFINE_ALIAS +# from .rnn import lstm_unit #DEFINE_ALIAS +from .vision import affine_channel #DEFINE_ALIAS +from .vision import affine_grid #DEFINE_ALIAS +from .vision import anchor_generator #DEFINE_ALIAS +from .vision import bipartite_match #DEFINE_ALIAS +from .vision import box_clip #DEFINE_ALIAS +from .vision import box_coder #DEFINE_ALIAS +from .vision import box_decoder_and_assign #DEFINE_ALIAS +from .vision import collect_fpn_proposals #DEFINE_ALIAS +# from .vision import deformable_conv #DEFINE_ALIAS +from .vision import deformable_roi_pooling #DEFINE_ALIAS +from .vision import density_prior_box #DEFINE_ALIAS +from .vision import detection_output #DEFINE_ALIAS +from .vision import distribute_fpn_proposals #DEFINE_ALIAS +# from .vision import fsp_matrix #DEFINE_ALIAS +from .vision import generate_mask_labels #DEFINE_ALIAS +from .vision import generate_proposal_labels #DEFINE_ALIAS +from .vision import generate_proposals #DEFINE_ALIAS +from .vision import grid_sampler #DEFINE_ALIAS +from .vision import image_resize #DEFINE_ALIAS +# from .vision import image_resize_short #DEFINE_ALIAS +# from .vision import multi_box_head #DEFINE_ALIAS +# from .vision import pixel_shuffle #DEFINE_ALIAS +from .vision import prior_box #DEFINE_ALIAS +from .vision import prroi_pool #DEFINE_ALIAS +from .vision import psroi_pool #DEFINE_ALIAS +from .vision import resize_bilinear #DEFINE_ALIAS +from .vision import resize_nearest #DEFINE_ALIAS +from .vision import resize_trilinear #DEFINE_ALIAS +# from .vision import retinanet_detection_output #DEFINE_ALIAS +# from .vision import retinanet_target_assign #DEFINE_ALIAS +from .vision import roi_align #DEFINE_ALIAS +# from .vision import roi_perspective_transform #DEFINE_ALIAS +from .vision import roi_pool #DEFINE_ALIAS +# from .vision import shuffle_channel #DEFINE_ALIAS +from .vision import space_to_depth #DEFINE_ALIAS +from .vision import yolo_box #DEFINE_ALIAS +from .vision import yolov3_loss #DEFINE_ALIAS diff --git a/python/paddle/nn/functional/activation.py b/python/paddle/nn/functional/activation.py index 64d5c7f449..b170117f1f 100644 --- a/python/paddle/nn/functional/activation.py +++ b/python/paddle/nn/functional/activation.py @@ -13,33 +13,55 @@ # limitations under the License. # TODO: define activation functions of neural network +from ...fluid.layers import brelu #DEFINE_ALIAS +from ...fluid.layers import elu #DEFINE_ALIAS +from ...fluid.layers import erf #DEFINE_ALIAS +from ...fluid.layers import gelu #DEFINE_ALIAS +from ...fluid.layers import hard_shrink #DEFINE_ALIAS +from ...fluid.layers import hard_sigmoid #DEFINE_ALIAS +from ...fluid.layers import hard_swish #DEFINE_ALIAS +from ...fluid.layers import leaky_relu #DEFINE_ALIAS +from ...fluid.layers import logsigmoid #DEFINE_ALIAS +from ...fluid.layers import maxout #DEFINE_ALIAS +from ...fluid.layers import relu6 #DEFINE_ALIAS +from ...fluid.layers import selu #DEFINE_ALIAS +from ...fluid.layers import soft_relu #DEFINE_ALIAS +from ...fluid.layers import softmax #DEFINE_ALIAS +from ...fluid.layers import softplus #DEFINE_ALIAS +from ...fluid.layers import softshrink #DEFINE_ALIAS +from ...fluid.layers import softsign #DEFINE_ALIAS +from ...fluid.layers import swish #DEFINE_ALIAS +from ...fluid.layers import tanh_shrink #DEFINE_ALIAS +from ...fluid.layers import thresholded_relu #DEFINE_ALIAS + __all__ = [ - # 'brelu', - # 'elu', - # 'erf', - # 'gelu', - # 'hard_shrink', - # 'hard_sigmoid', - # 'hard_swish', + 'brelu', + 'elu', + 'erf', + 'gelu', + 'hard_shrink', + 'hard_sigmoid', + 'hard_swish', 'hsigmoid', - # 'leaky_relu', - # 'logsigmoid', - # 'maxout', - # 'prelu', + 'leaky_relu', + 'logsigmoid', + 'maxout', + # 'prelu', 'relu', - # 'relu6', - # 'selu', + 'relu6', + 'selu', 'sigmoid', - # 'soft_relu', - # 'softmax', - # 'softplus', - # 'softshrink', - # 'softsign', - # 'swish', - # 'tanh_shrink', - # 'thresholded_relu', + 'soft_relu', + 'softmax', + 'softplus', + 'softshrink', + 'softsign', + 'swish', + 'tanh_shrink', + 'thresholded_relu', 'log_softmax' ] + import warnings from ...fluid.layer_helper import LayerHelper from ...fluid.framework import in_dygraph_mode, convert_np_dtype_to_dtype_ diff --git a/python/paddle/nn/functional/common.py b/python/paddle/nn/functional/common.py index cb4473d22f..f33c317681 100644 --- a/python/paddle/nn/functional/common.py +++ b/python/paddle/nn/functional/common.py @@ -17,20 +17,28 @@ from paddle.fluid.layer_helper import LayerHelper from paddle.fluid.layers.tensor import Variable, fill_constant # TODO: define the common functions to build a neural network -# __all__ = ['dropout', -# 'embedding', -# 'fc', -# 'label_smooth', -# 'one_hot', -# 'pad', -# 'pad_constant_like', -# 'pad2d', -# 'unfold', -# 'bilinear_tensor_product', -# 'assign', -# 'interpolate'] - -__all__ = ['interpolate'] +from ...fluid.layers import dropout #DEFINE_ALIAS +from ...fluid.layers import label_smooth #DEFINE_ALIAS +from ...fluid import one_hot #DEFINE_ALIAS +from ...fluid.layers import pad #DEFINE_ALIAS +from ...fluid.layers import pad2d #DEFINE_ALIAS +from ...fluid.layers import unfold #DEFINE_ALIAS +from ...fluid.layers import assign #DEFINE_ALIAS + +__all__ = [ + 'dropout', + # 'embedding', + # 'fc', + 'label_smooth', + 'one_hot', + 'pad', + # 'pad_constant_like', + 'pad2d', + 'unfold', + # 'bilinear_tensor_product', + 'assign', + 'interpolate' +] def interpolate(input, diff --git a/python/paddle/nn/functional/conv.py b/python/paddle/nn/functional/conv.py index 6b37c1c68b..ea677eb0c6 100644 --- a/python/paddle/nn/functional/conv.py +++ b/python/paddle/nn/functional/conv.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from __future__ import print_function + __all__ = ['conv2d', 'conv2d_transpose', 'conv3d', 'conv3d_transpose'] import numpy as np diff --git a/python/paddle/nn/functional/extension.py b/python/paddle/nn/functional/extension.py index 112212bfab..0437ae7492 100644 --- a/python/paddle/nn/functional/extension.py +++ b/python/paddle/nn/functional/extension.py @@ -13,22 +13,27 @@ # limitations under the License. # TODO: define the extention functions +from ...fluid.layers import add_position_encoding #DEFINE_ALIAS +from ...fluid.layers import multiclass_nms #DEFINE_ALIAS +from ...fluid.layers import target_assign #DEFINE_ALIAS +from ...fluid.layers import temporal_shift #DEFINE_ALIAS + __all__ = [ - # 'add_position_encoding', - # 'autoincreased_step_counter', - # 'continuous_value_model', - # 'filter_by_instag', - # 'linear_chain_crf', - # 'merge_selected_rows', - # 'multiclass_nms', - # 'polygon_box_transform', - # 'random_crop', + 'add_position_encoding', + # 'autoincreased_step_counter', + # 'continuous_value_model', + # 'filter_by_instag', + # 'linear_chain_crf', + # 'merge_selected_rows', + 'multiclass_nms', + # 'polygon_box_transform', + # 'random_crop', 'row_conv', - # 'rpn_target_assign', - # 'similarity_focus', - # 'target_assign', - # 'temporal_shift', - # 'warpctc', + # 'rpn_target_assign', + # 'similarity_focus', + 'target_assign', + 'temporal_shift', + # 'warpctc', 'diag_embed' ] diff --git a/python/paddle/nn/functional/learning_rate.py b/python/paddle/nn/functional/learning_rate.py index 20be798724..83837fc5d4 100644 --- a/python/paddle/nn/functional/learning_rate.py +++ b/python/paddle/nn/functional/learning_rate.py @@ -13,11 +13,17 @@ # limitations under the License. # TODO: define learning rate decay -# __all__ = ['cosine_decay', -# 'exponential_decay', -# 'inverse_time_decay', -# 'natural_exp_decay', -# 'noam_decay', -# 'piecewise_decay', -# 'polynomial_decay', -# 'linear_lr_warmup'] +from ...fluid.layers import cosine_decay #DEFINE_ALIAS +from ...fluid.layers import exponential_decay #DEFINE_ALIAS +from ...fluid.layers import inverse_time_decay #DEFINE_ALIAS +from ...fluid.layers import natural_exp_decay #DEFINE_ALIAS +from ...fluid.layers import noam_decay #DEFINE_ALIAS +from ...fluid.layers import piecewise_decay #DEFINE_ALIAS +from ...fluid.layers import polynomial_decay #DEFINE_ALIAS +from ...fluid.layers import linear_lr_warmup #DEFINE_ALIAS + +__all__ = [ + 'cosine_decay', 'exponential_decay', 'inverse_time_decay', + 'natural_exp_decay', 'noam_decay', 'piecewise_decay', 'polynomial_decay', + 'linear_lr_warmup' +] diff --git a/python/paddle/nn/functional/lod.py b/python/paddle/nn/functional/lod.py index b89f10d0a0..266e3f9c71 100644 --- a/python/paddle/nn/functional/lod.py +++ b/python/paddle/nn/functional/lod.py @@ -13,32 +13,36 @@ # limitations under the License. # TODO: define functions which accept only LoDTensor as input -# __all__ = ['sequence_concat', -# 'sequence_conv', -# 'sequence_enumerate', -# 'sequence_expand_as', -# 'sequence_expand', -# 'sequence_first_step', -# 'sequence_last_step', -# 'sequence_mask', -# 'sequence_pad', -# 'sequence_pool', -# 'sequence_reshape', -# 'sequence_reverse', -# 'sequence_scatter', -# 'sequence_slice', -# 'sequence_softmax', -# 'sequence_unpad', -# 'array_length', -# 'array_read', -# 'array_write', -# 'create_array', -# 'hash', -# 'im2sequence', -# 'lod_append', -# 'lod_reset', -# 'reorder_lod_tensor_by_rank', -# 'tensor_array_to_tensor', -# 'dynamic_gru', -# 'dynamic_lstm', -# 'dynamic_lstmp'] +from ...fluid.layers import hash #DEFINE_ALIAS + +__all__ = [ + # 'sequence_concat', + # 'sequence_conv', + # 'sequence_enumerate', + # 'sequence_expand_as', + # 'sequence_expand', + # 'sequence_first_step', + # 'sequence_last_step', + # 'sequence_mask', + # 'sequence_pad', + # 'sequence_pool', + # 'sequence_reshape', + # 'sequence_reverse', + # 'sequence_scatter', + # 'sequence_slice', + # 'sequence_softmax', + # 'sequence_unpad', + # 'array_length', + # 'array_read', + # 'array_write', + # 'create_array', + 'hash', + # 'im2sequence', + # 'lod_append', + # 'lod_reset', + # 'reorder_lod_tensor_by_rank', + # 'tensor_array_to_tensor', + # 'dynamic_gru', + # 'dynamic_lstm', + # 'dynamic_lstmp' +] diff --git a/python/paddle/nn/functional/loss.py b/python/paddle/nn/functional/loss.py index f0727d5d83..112cd112f2 100644 --- a/python/paddle/nn/functional/loss.py +++ b/python/paddle/nn/functional/loss.py @@ -13,25 +13,45 @@ # limitations under the License. # TODO: define loss functions of neural network -# __all__ = ['bpr_loss', -# 'center_loss', -# 'cross_entropy', -# 'dice_loss', -# 'edit_distance', -# 'huber_loss', -# 'iou_similarity', -# 'kldiv_loss', -# 'log_loss', -# 'margin_rank_loss', -# 'mse_loss', -# 'nce', -# 'npair_loss', -# 'rank_loss', -# 'sampled_softmax_with_cross_entropy', -# 'sigmoid_cross_entropy_with_logits', -# 'sigmoid_focal_loss', -# 'smooth_l1', -# 'softmax_with_cross_entropy', -# 'square_error_cost', -# 'ssd_loss', -# 'teacher_student_sigmoid_loss'] +from ...fluid.layers import bpr_loss #DEFINE_ALIAS +from ...fluid.layers import center_loss #DEFINE_ALIAS +from ...fluid.layers import cross_entropy #DEFINE_ALIAS +from ...fluid.layers import dice_loss #DEFINE_ALIAS +from ...fluid.layers import iou_similarity #DEFINE_ALIAS +from ...fluid.layers import kldiv_loss #DEFINE_ALIAS +from ...fluid.layers import log_loss #DEFINE_ALIAS +from ...fluid.layers import mse_loss #DEFINE_ALIAS +from ...fluid.layers import npair_loss #DEFINE_ALIAS +from ...fluid.layers import rank_loss #DEFINE_ALIAS +from ...fluid.layers import sigmoid_cross_entropy_with_logits #DEFINE_ALIAS +from ...fluid.layers import sigmoid_focal_loss #DEFINE_ALIAS +from ...fluid.layers import smooth_l1 #DEFINE_ALIAS +from ...fluid.layers import softmax_with_cross_entropy #DEFINE_ALIAS +from ...fluid.layers import square_error_cost #DEFINE_ALIAS +from ...fluid.layers import ssd_loss #DEFINE_ALIAS +from ...fluid.layers import teacher_student_sigmoid_loss #DEFINE_ALIAS + +__all__ = [ + 'bpr_loss', + 'center_loss', + 'cross_entropy', + 'dice_loss', + # 'edit_distance', + # 'huber_loss', + 'iou_similarity', + 'kldiv_loss', + 'log_loss', + # 'margin_rank_loss', + 'mse_loss', + # 'nce', + 'npair_loss', + 'rank_loss', + # 'sampled_softmax_with_cross_entropy', + 'sigmoid_cross_entropy_with_logits', + 'sigmoid_focal_loss', + 'smooth_l1', + 'softmax_with_cross_entropy', + 'square_error_cost', + 'ssd_loss', + 'teacher_student_sigmoid_loss' +] diff --git a/python/paddle/nn/functional/norm.py b/python/paddle/nn/functional/norm.py index 9e7c55218d..04b031b91c 100644 --- a/python/paddle/nn/functional/norm.py +++ b/python/paddle/nn/functional/norm.py @@ -13,11 +13,16 @@ # limitations under the License. # TODO: define normalization api -# __all__ = ['batch_norm', -# 'data_norm', -# 'group_norm', -# 'instance_norm', -# 'l2_normalize', -# 'layer_norm', -# 'lrn', -# 'spectral_norm'] +from ...fluid.layers import l2_normalize #DEFINE_ALIAS +from ...fluid.layers import lrn #DEFINE_ALIAS + +__all__ = [ + # 'batch_norm', + # 'data_norm', + # 'group_norm', + # 'instance_norm', + 'l2_normalize', + # 'layer_norm', + 'lrn', + # 'spectral_norm' +] diff --git a/python/paddle/nn/functional/pooling.py b/python/paddle/nn/functional/pooling.py index e8700f8e2c..618145fb1f 100644 --- a/python/paddle/nn/functional/pooling.py +++ b/python/paddle/nn/functional/pooling.py @@ -13,7 +13,9 @@ # limitations under the License. # TODO: define pooling functions -# __all__ = ['pool2d', -# 'pool3d', -# 'adaptive_pool2d', -# 'adaptive_pool3d'] +from ...fluid.layers import pool2d #DEFINE_ALIAS +from ...fluid.layers import pool3d #DEFINE_ALIAS +from ...fluid.layers import adaptive_pool2d #DEFINE_ALIAS +from ...fluid.layers import adaptive_pool3d #DEFINE_ALIAS + +__all__ = ['pool2d', 'pool3d', 'adaptive_pool2d', 'adaptive_pool3d'] diff --git a/python/paddle/nn/functional/rnn.py b/python/paddle/nn/functional/rnn.py index 4f2b89d35c..520cf44360 100644 --- a/python/paddle/nn/functional/rnn.py +++ b/python/paddle/nn/functional/rnn.py @@ -13,6 +13,9 @@ # limitations under the License. # TODO: define function of recurrent neural network -# __all__ = ['gru_unit', -# 'lstm', -# 'lstm_unit'] + +__all__ = [ + # 'gru_unit', + # 'lstm', + # 'lstm_unit' +] diff --git a/python/paddle/nn/functional/vision.py b/python/paddle/nn/functional/vision.py index 11ef3dc271..a1dd90acaa 100644 --- a/python/paddle/nn/functional/vision.py +++ b/python/paddle/nn/functional/vision.py @@ -13,40 +13,71 @@ # limitations under the License. # TODO: define specitial functions used in computer vision task -# __all__ = ['affine_channel', -# 'affine_grid', -# 'anchor_generator', -# 'bipartite_match', -# 'box_clip', -# 'box_coder', -# 'box_decoder_and_assign', -# 'collect_fpn_proposals', -# 'deformable_conv', -# 'deformable_roi_pooling', -# 'density_prior_box', -# 'detection_output', -# 'distribute_fpn_proposals', -# 'fsp_matrix', -# 'generate_mask_labels', -# 'generate_proposal_labels', -# 'generate_proposals', -# 'grid_sampler', -# 'image_resize', -# 'image_resize_short', -# 'multi_box_head', -# 'pixel_shuffle', -# 'prior_box', -# 'prroi_pool', -# 'psroi_pool', -# 'resize_bilinear', -# 'resize_nearest', -# 'resize_trilinear', -# 'retinanet_detection_output', -# 'retinanet_target_assign', -# 'roi_align', -# 'roi_perspective_transform', -# 'roi_pool', -# 'shuffle_channel', -# 'space_to_depth', -# 'yolo_box', -# 'yolov3_loss'] +from ...fluid.layers import affine_channel #DEFINE_ALIAS +from ...fluid.layers import affine_grid #DEFINE_ALIAS +from ...fluid.layers import anchor_generator #DEFINE_ALIAS +from ...fluid.layers import bipartite_match #DEFINE_ALIAS +from ...fluid.layers import box_clip #DEFINE_ALIAS +from ...fluid.layers import box_coder #DEFINE_ALIAS +from ...fluid.layers import box_decoder_and_assign #DEFINE_ALIAS +from ...fluid.layers import collect_fpn_proposals #DEFINE_ALIAS +from ...fluid.layers import deformable_roi_pooling #DEFINE_ALIAS +from ...fluid.layers import density_prior_box #DEFINE_ALIAS +from ...fluid.layers import detection_output #DEFINE_ALIAS +from ...fluid.layers import distribute_fpn_proposals #DEFINE_ALIAS +from ...fluid.layers import generate_mask_labels #DEFINE_ALIAS +from ...fluid.layers import generate_proposal_labels #DEFINE_ALIAS +from ...fluid.layers import generate_proposals #DEFINE_ALIAS +from ...fluid.layers import grid_sampler #DEFINE_ALIAS +from ...fluid.layers import image_resize #DEFINE_ALIAS +from ...fluid.layers import prior_box #DEFINE_ALIAS +from ...fluid.layers import prroi_pool #DEFINE_ALIAS +from ...fluid.layers import psroi_pool #DEFINE_ALIAS +from ...fluid.layers import resize_bilinear #DEFINE_ALIAS +from ...fluid.layers import resize_nearest #DEFINE_ALIAS +from ...fluid.layers import resize_trilinear #DEFINE_ALIAS +from ...fluid.layers import roi_align #DEFINE_ALIAS +from ...fluid.layers import roi_pool #DEFINE_ALIAS +from ...fluid.layers import space_to_depth #DEFINE_ALIAS +from ...fluid.layers import yolo_box #DEFINE_ALIAS +from ...fluid.layers import yolov3_loss #DEFINE_ALIAS + +__all__ = [ + 'affine_channel', + 'affine_grid', + 'anchor_generator', + 'bipartite_match', + 'box_clip', + 'box_coder', + 'box_decoder_and_assign', + 'collect_fpn_proposals', + # 'deformable_conv', + 'deformable_roi_pooling', + 'density_prior_box', + 'detection_output', + 'distribute_fpn_proposals', + # 'fsp_matrix', + 'generate_mask_labels', + 'generate_proposal_labels', + 'generate_proposals', + 'grid_sampler', + 'image_resize', + # 'image_resize_short', + # 'multi_box_head', + # 'pixel_shuffle', + 'prior_box', + 'prroi_pool', + 'psroi_pool', + 'resize_bilinear', + 'resize_nearest', + 'resize_trilinear', + # 'retinanet_detection_output', + # 'retinanet_target_assign', + 'roi_align', + # 'roi_perspective_transform', + 'roi_pool', + # 'shuffle_channel', + 'space_to_depth', + 'yolo_box', + 'yolov3_loss' +] diff --git a/python/paddle/nn/initalizer.py b/python/paddle/nn/initalizer.py index 3884ea0a80..55ae7d649b 100644 --- a/python/paddle/nn/initalizer.py +++ b/python/paddle/nn/initalizer.py @@ -13,10 +13,13 @@ # limitations under the License. # TODO: define the initializers to create a Parameter in neural network -# __all__ = ['Bilinear', -# 'Constant', -# 'MSRA', -# 'Normal', -# 'TruncatedNormal', -# 'Uniform', -# 'Xavier'] + +__all__ = [ + # 'Bilinear', + # 'Constant', + # 'MSRA', + # 'Normal', + # 'TruncatedNormal', + # 'Uniform', + # 'Xavier' +] diff --git a/python/paddle/nn/input.py b/python/paddle/nn/input.py index d48770b864..b5f591f44a 100644 --- a/python/paddle/nn/input.py +++ b/python/paddle/nn/input.py @@ -13,4 +13,9 @@ # limitations under the License. # TODO: define input placeholders of neural network -# __all__ = ['data', 'Input'] +from ..fluid import data #DEFINE_ALIAS + +__all__ = [ + 'data', + # 'Input' +] diff --git a/python/paddle/nn/layer/__init__.py b/python/paddle/nn/layer/__init__.py index ff8208f350..90bb6d0ada 100644 --- a/python/paddle/nn/layer/__init__.py +++ b/python/paddle/nn/layer/__init__.py @@ -27,3 +27,42 @@ from .conv import * from .extension import * from .activation import * from .norm import * +# from .activation import PReLU #DEFINE_ALIAS +from .activation import ReLU #DEFINE_ALIAS +from .activation import Sigmoid #DEFINE_ALIAS +# from .activation import Softmax #DEFINE_ALIAS +from .activation import LogSoftmax #DEFINE_ALIAS +from .activation import HSigmoid #DEFINE_ALIAS +from .common import BilinearTensorProduct #DEFINE_ALIAS +from .common import Pool2D #DEFINE_ALIAS +from .common import Embedding #DEFINE_ALIAS +from .common import Linear #DEFINE_ALIAS +# from .common import UpSample #DEFINE_ALIAS +from .conv import Conv2D #DEFINE_ALIAS +from .conv import Conv2DTranspose #DEFINE_ALIAS +from .conv import Conv3D #DEFINE_ALIAS +from .conv import Conv3DTranspose #DEFINE_ALIAS +# from .conv import TreeConv #DEFINE_ALIAS +# from .conv import Conv1D #DEFINE_ALIAS +from .extension import RowConv #DEFINE_ALIAS +# from .learning_rate import CosineDecay #DEFINE_ALIAS +# from .learning_rate import ExponentialDecay #DEFINE_ALIAS +# from .learning_rate import InverseTimeDecay #DEFINE_ALIAS +# from .learning_rate import NaturalExpDecay #DEFINE_ALIAS +# from .learning_rate import NoamDecay #DEFINE_ALIAS +# from .learning_rate import PiecewiseDecay #DEFINE_ALIAS +# from .learning_rate import PolynomialDecay #DEFINE_ALIAS +# from .loss import NCELoss #DEFINE_ALIAS +from .loss import CrossEntropyLoss #DEFINE_ALIAS +from .loss import MSELoss #DEFINE_ALIAS +from .loss import L1Loss #DEFINE_ALIAS +from .loss import NLLLoss #DEFINE_ALIAS +from .loss import BCELoss #DEFINE_ALIAS +from .norm import BatchNorm #DEFINE_ALIAS +from .norm import GroupNorm #DEFINE_ALIAS +from .norm import LayerNorm #DEFINE_ALIAS +from .norm import SpectralNorm #DEFINE_ALIAS +from .norm import InstanceNorm #DEFINE_ALIAS +# from .rnn import RNNCell #DEFINE_ALIAS +# from .rnn import GRUCell #DEFINE_ALIAS +# from .rnn import LSTMCell #DEFINE_ALIAS diff --git a/python/paddle/nn/layer/activation.py b/python/paddle/nn/layer/activation.py index 73d7084fdb..3ed56062c2 100644 --- a/python/paddle/nn/layer/activation.py +++ b/python/paddle/nn/layer/activation.py @@ -13,11 +13,12 @@ # limitations under the License. # TODO: define activation functions of neural network + __all__ = [ - # 'PReLU', + # 'PReLU', 'ReLU', 'Sigmoid', - # 'Softmax', + # 'Softmax', 'LogSoftmax', 'HSigmoid' ] diff --git a/python/paddle/nn/layer/common.py b/python/paddle/nn/layer/common.py index 37f7013458..02abf891ff 100644 --- a/python/paddle/nn/layer/common.py +++ b/python/paddle/nn/layer/common.py @@ -13,8 +13,15 @@ # limitations under the License. # TODO: define the common classes to build a neural network -# __all__ = ['BilinearTensorProduct', -# 'Pool2D', -# 'Embedding', -# 'Linear', -# 'UpSample'] +from ...fluid.dygraph import BilinearTensorProduct #DEFINE_ALIAS +from ...fluid.dygraph import Pool2D #DEFINE_ALIAS +from ...fluid.dygraph import Embedding #DEFINE_ALIAS +from ...fluid.dygraph import Linear #DEFINE_ALIAS + +__all__ = [ + 'BilinearTensorProduct', + 'Pool2D', + 'Embedding', + 'Linear', + # 'UpSample' +] diff --git a/python/paddle/nn/layer/conv.py b/python/paddle/nn/layer/conv.py index 330841f094..1980796d26 100644 --- a/python/paddle/nn/layer/conv.py +++ b/python/paddle/nn/layer/conv.py @@ -13,13 +13,14 @@ # limitations under the License. # TODO: define classes of convolutional neural network + __all__ = [ 'Conv2D', 'Conv2DTranspose', 'Conv3D', 'Conv3DTranspose', - # 'TreeConv', - # 'Conv1D' + # 'TreeConv', + # 'Conv1D' ] import numpy as np diff --git a/python/paddle/nn/layer/extension.py b/python/paddle/nn/layer/extension.py index 3a3779cc4b..d3e0b79c14 100644 --- a/python/paddle/nn/layer/extension.py +++ b/python/paddle/nn/layer/extension.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__all__ = ["RowConv"] +__all__ = ['RowConv'] from ...fluid.dygraph import layers from .. import functional as F diff --git a/python/paddle/nn/layer/learning_rate.py b/python/paddle/nn/layer/learning_rate.py index c1ab2b83b2..e91f755cb0 100644 --- a/python/paddle/nn/layer/learning_rate.py +++ b/python/paddle/nn/layer/learning_rate.py @@ -13,10 +13,13 @@ # limitations under the License. # TODO: define learning rate decay -# __all__ = ['CosineDecay', -# 'ExponentialDecay', -# 'InverseTimeDecay', -# 'NaturalExpDecay', -# 'NoamDecay', -# 'PiecewiseDecay', -# 'PolynomialDecay'] + +__all__ = [ + # 'CosineDecay', + # 'ExponentialDecay', + # 'InverseTimeDecay', + # 'NaturalExpDecay', + # 'NoamDecay', + # 'PiecewiseDecay', + # 'PolynomialDecay' +] diff --git a/python/paddle/nn/layer/loss.py b/python/paddle/nn/layer/loss.py index 05fc3e2629..db72424500 100644 --- a/python/paddle/nn/layer/loss.py +++ b/python/paddle/nn/layer/loss.py @@ -14,8 +14,9 @@ # TODO: define loss functions of neural network import paddle.fluid as fluid + __all__ = [ - #'NCELoss', + # 'NCELoss', 'CrossEntropyLoss', 'MSELoss', 'L1Loss', diff --git a/python/paddle/nn/layer/norm.py b/python/paddle/nn/layer/norm.py index d02807773b..1beba62c18 100644 --- a/python/paddle/nn/layer/norm.py +++ b/python/paddle/nn/layer/norm.py @@ -13,10 +13,14 @@ # limitations under the License. # TODO: define normalization api -# __all__ = ['BatchNorm', -# 'GroupNorm', -# 'LayerNorm', -# 'SpectralNorm'] -__all__ = ['InstanceNorm'] from ...fluid.dygraph.nn import InstanceNorm + +from ...fluid.dygraph import BatchNorm #DEFINE_ALIAS +from ...fluid.dygraph import GroupNorm #DEFINE_ALIAS +from ...fluid.dygraph import LayerNorm #DEFINE_ALIAS +from ...fluid.dygraph import SpectralNorm #DEFINE_ALIAS + +__all__ = [ + 'BatchNorm', 'GroupNorm', 'LayerNorm', 'SpectralNorm', 'InstanceNorm' +] diff --git a/python/paddle/nn/layer/rnn.py b/python/paddle/nn/layer/rnn.py index 65222e34f9..4717609503 100644 --- a/python/paddle/nn/layer/rnn.py +++ b/python/paddle/nn/layer/rnn.py @@ -13,4 +13,9 @@ # limitations under the License. # TODO: define classes of recurrent neural network -# __all__ = ['RNNCell', 'GRUCell', 'LSTMCell'] + +__all__ = [ + # 'RNNCell', + # 'GRUCell', + # 'LSTMCell' +] diff --git a/python/paddle/tensor/__init__.py b/python/paddle/tensor/__init__.py index d8f76a8e39..2232f252bc 100644 --- a/python/paddle/tensor/__init__.py +++ b/python/paddle/tensor/__init__.py @@ -19,97 +19,123 @@ from __future__ import print_function # TODO: define alias in tensor and framework directory -# from .creation import create_tensor #DEFINE_ALIAS -# from .creation import create_lod_tensor #DEFINE_ALIAS -# from .creation import create_random_int_lod #DEFINE_ALIAS -# from .creation import crop_tensor #DEFINE_ALIAS -# from .creation import diag #DEFINE_ALIAS +from .random import randperm +from .attribute import rank #DEFINE_ALIAS +from .attribute import shape #DEFINE_ALIAS +# from .creation import create_tensor #DEFINE_ALIAS +# from .creation import create_lod_tensor #DEFINE_ALIAS +# from .creation import create_random_int_lodtensor #DEFINE_ALIAS +from .creation import crop_tensor #DEFINE_ALIAS +from .creation import diag #DEFINE_ALIAS from .creation import eye #DEFINE_ALIAS -# from .creation import fill_constant #DEFINE_ALIAS -# from .creation import get__from_selected_rows #DEFINE_ALIAS +from .creation import fill_constant #DEFINE_ALIAS +# from .creation import get_tensor_from_selected_rows #DEFINE_ALIAS from .creation import linspace #DEFINE_ALIAS -# from .creation import ones #DEFINE_ALIAS -# from .creation import ones_like #DEFINE_ALIAS -# from .creation import range #DEFINE_ALIAS -# from .creation import zeros #DEFINE_ALIAS -# from .creation import zeros_like #DEFINE_ALIAS +from .creation import ones #DEFINE_ALIAS +from .creation import ones_like #DEFINE_ALIAS +from .creation import zeros #DEFINE_ALIAS +from .creation import zeros_like #DEFINE_ALIAS from .creation import arange #DEFINE_ALIAS -# from .creation import eye #DEFINE_ALIAS -from .creation import full # DEFINE_ALIAS -# from .creation import linspace #DEFINE_ALIAS +from .creation import eye #DEFINE_ALIAS +from .creation import full #DEFINE_ALIAS from .creation import full_like #DEFINE_ALIAS from .creation import triu #DEFINE_ALIAS from .creation import tril #DEFINE_ALIAS from .creation import meshgrid #DEFINE_ALIAS -# from .stat import mean #DEFINE_ALIAS -# from .stat import reduce_mean #DEFINE_ALIAS -from .stat import std #DEFINE_ALIAS -# from .stat import var #DEFINE_ALIAS +from .io import save #DEFINE_ALIAS +from .io import load #DEFINE_ALIAS +from .linalg import matmul #DEFINE_ALIAS +from .linalg import dot #DEFINE_ALIAS +# from .linalg import einsum #DEFINE_ALIAS +from .linalg import norm #DEFINE_ALIAS +from .linalg import transpose #DEFINE_ALIAS +from .linalg import dist #DEFINE_ALIAS +from .linalg import t #DEFINE_ALIAS +from .linalg import cross #DEFINE_ALIAS +from .linalg import cholesky #DEFINE_ALIAS +# from .linalg import tensordot #DEFINE_ALIAS +from .linalg import bmm #DEFINE_ALIAS from .logic import equal #DEFINE_ALIAS -# from .logic import greater_equal #DEFINE_ALIAS -# from .logic import greater_than #DEFINE_ALIAS -# from .logic import is_empty #DEFINE_ALIAS -# from .logic import isfinite #DEFINE_ALIAS -# from .logic import less_equal #DEFINE_ALIAS -# from .logic import less_than #DEFINE_ALIAS -# from .logic import logical_and #DEFINE_ALIAS -# from .logic import logical_not #DEFINE_ALIAS -# from .logic import logical_or #DEFINE_ALIAS -# from .logic import logical_xor #DEFINE_ALIAS -# from .logic import not_equal #DEFINE_ALIAS -# from .logic import reduce_all #DEFINE_ALIAS -# from .logic import reduce_any #DEFINE_ALIAS +from .logic import greater_equal #DEFINE_ALIAS +from .logic import greater_than #DEFINE_ALIAS +from .logic import is_empty #DEFINE_ALIAS +from .logic import isfinite #DEFINE_ALIAS +from .logic import less_equal #DEFINE_ALIAS +from .logic import less_than #DEFINE_ALIAS +from .logic import logical_and #DEFINE_ALIAS +from .logic import logical_not #DEFINE_ALIAS +from .logic import logical_or #DEFINE_ALIAS +from .logic import logical_xor #DEFINE_ALIAS +from .logic import not_equal #DEFINE_ALIAS +from .logic import reduce_all #DEFINE_ALIAS +from .logic import reduce_any #DEFINE_ALIAS from .logic import allclose #DEFINE_ALIAS from .logic import elementwise_equal #DEFINE_ALIAS -# from .logic import isnan #DEFINE_ALIAS -# from . import Tensor #DEFINE_ALIAS -# from . import LoDTensor #DEFINE_ALIAS -# from . import LoDTensorArray #DEFINE_ALIAS -# from .random import gaussin #DEFINE_ALIAS -# from .random import uniform #DEFINE_ALIAS -# from .random import shuffle #DEFINE_ALIAS -from .random import randn #DEFINE_ALIAS -from .random import rand #DEFINE_ALIAS -from .random import randint #DEFINE_ALIAS -from .random import randperm -# from .math import abs #DEFINE_ALIAS -# from .math import acos #DEFINE_ALIAS -# from .math import asin #DEFINE_ALIAS +# from .logic import isnan #DEFINE_ALIAS +from .manipulation import cast #DEFINE_ALIAS +from .manipulation import concat #DEFINE_ALIAS +from .manipulation import expand #DEFINE_ALIAS +from .manipulation import expand_as #DEFINE_ALIAS +from .manipulation import flatten #DEFINE_ALIAS +from .manipulation import gather #DEFINE_ALIAS +# from .manipulation import gather_nd #DEFINE_ALIAS +from .manipulation import reshape #DEFINE_ALIAS +from .manipulation import reverse #DEFINE_ALIAS +from .manipulation import scatter #DEFINE_ALIAS +# from .manipulation import scatter_nd_add #DEFINE_ALIAS +# from .manipulation import scatter_nd #DEFINE_ALIAS +# from .manipulation import shard_index #DEFINE_ALIAS +from .manipulation import slice #DEFINE_ALIAS +from .manipulation import split #DEFINE_ALIAS +from .manipulation import squeeze #DEFINE_ALIAS +from .manipulation import stack #DEFINE_ALIAS +from .manipulation import strided_slice #DEFINE_ALIAS +from .manipulation import transpose #DEFINE_ALIAS +from .manipulation import unique #DEFINE_ALIAS +# from .manipulation import unique_with_counts #DEFINE_ALIAS +from .manipulation import unsqueeze #DEFINE_ALIAS +from .manipulation import unstack #DEFINE_ALIAS +from .manipulation import flip #DEFINE_ALIAS +# from .manipulation import unbind #DEFINE_ALIAS +from .manipulation import roll #DEFINE_ALIAS +from .math import abs #DEFINE_ALIAS +from .math import acos #DEFINE_ALIAS +from .math import asin #DEFINE_ALIAS from .math import atan #DEFINE_ALIAS -# from .math import ceil #DEFINE_ALIAS -# from .math import cos #DEFINE_ALIAS -# from .math import cumsum #DEFINE_ALIAS -# from .math import elementwise_add #DEFINE_ALIAS -# from .math import elementwise_div #DEFINE_ALIAS -# from .math import elementwise_floordiv #DEFINE_ALIAS -# from .math import elementwise_max #DEFINE_ALIAS -# from .math import elementwise_min #DEFINE_ALIAS -# from .math import elementwise_mod #DEFINE_ALIAS -# from .math import elementwise_mul #DEFINE_ALIAS -# from .math import elementwise_pow #DEFINE_ALIAS -# from .math import elementwise_sub #DEFINE_ALIAS -# from .math import exp #DEFINE_ALIAS -# from .math import floor #DEFINE_ALIAS -# from .math import increment #DEFINE_ALIAS -# from .math import log #DEFINE_ALIAS +from .math import ceil #DEFINE_ALIAS +from .math import cos #DEFINE_ALIAS +from .math import cumsum #DEFINE_ALIAS +from .math import elementwise_add #DEFINE_ALIAS +from .math import elementwise_div #DEFINE_ALIAS +from .math import elementwise_floordiv #DEFINE_ALIAS +from .math import elementwise_max #DEFINE_ALIAS +from .math import elementwise_min #DEFINE_ALIAS +from .math import elementwise_mod #DEFINE_ALIAS +from .math import elementwise_mul #DEFINE_ALIAS +from .math import elementwise_pow #DEFINE_ALIAS +from .math import elementwise_sub #DEFINE_ALIAS +from .math import exp #DEFINE_ALIAS +from .math import floor #DEFINE_ALIAS +# from .math import increment #DEFINE_ALIAS +from .math import log #DEFINE_ALIAS from .math import mul #DEFINE_ALIAS -# from .math import multiplex #DEFINE_ALIAS +# from .math import multiplex #DEFINE_ALIAS from .math import pow #DEFINE_ALIAS -# from .math import reciprocal #DEFINE_ALIAS -# from .math import reduce_max #DEFINE_ALIAS -# from .math import reduce_min #DEFINE_ALIAS -# from .math import reduce_prod #DEFINE_ALIAS -# from .math import reduce_sum #DEFINE_ALIAS -# from .math import round #DEFINE_ALIAS -# from .math import rsqrt #DEFINE_ALIAS -# from .math import scale #DEFINE_ALIAS -# from .math import sign #DEFINE_ALIAS +from .math import reciprocal #DEFINE_ALIAS +from .math import reduce_max #DEFINE_ALIAS +from .math import reduce_min #DEFINE_ALIAS +from .math import reduce_prod #DEFINE_ALIAS +from .math import reduce_sum #DEFINE_ALIAS +from .math import round #DEFINE_ALIAS +from .math import rsqrt #DEFINE_ALIAS +from .math import scale #DEFINE_ALIAS +from .math import sign #DEFINE_ALIAS from .math import sin #DEFINE_ALIAS from .math import sqrt #DEFINE_ALIAS -# from .math import square #DEFINE_ALIAS -# from .math import stanh #DEFINE_ALIAS +from .math import square #DEFINE_ALIAS +from .math import stanh #DEFINE_ALIAS from .math import sum #DEFINE_ALIAS -# from .math import sums #DEFINE_ALIAS +# from .math import sums #DEFINE_ALIAS from .math import tanh #DEFINE_ALIAS from .math import elementwise_sum #DEFINE_ALIAS from .math import max #DEFINE_ALIAS @@ -117,65 +143,38 @@ from .math import min #DEFINE_ALIAS from .math import mm #DEFINE_ALIAS from .math import div #DEFINE_ALIAS from .math import add #DEFINE_ALIAS -from .math import kron #DEFINE_ALIAS -# from .math import atan #DEFINE_ALIAS +from .math import atan #DEFINE_ALIAS from .math import logsumexp #DEFINE_ALIAS -# from .math import inverse #DEFINE_ALIAS +# from .math import inverse #DEFINE_ALIAS from .math import log1p #DEFINE_ALIAS -# from .math import erf #DEFINE_ALIAS +from .math import erf #DEFINE_ALIAS from .math import addcmul #DEFINE_ALIAS from .math import addmm #DEFINE_ALIAS from .math import clamp #DEFINE_ALIAS -# from .attribute import rank #DEFINE_ALIAS -# from .attribute import shape #DEFINE_ALIAS -# from .io import save #DEFINE_ALIAS -# from .io import load #DEFINE_ALIAS -from .linalg import matmul #DEFINE_ALIAS -from .linalg import dot #DEFINE_ALIAS -# from .linalg import einsum #DEFINE_ALIAS -from .linalg import norm #DEFINE_ALIAS -# from .linalg import transpose #DEFINE_ALIAS -from .linalg import dist #DEFINE_ALIAS -from .linalg import t #DEFINE_ALIAS -from .linalg import cross #DEFINE_ALIAS -# from .linalg import cholesky #DEFINE_ALIAS -# from .linalg import dot #DEFINE_ALIAS -from .linalg import bmm #DEFINE_ALIAS -# from .manipulation import cast #DEFINE_ALIAS -# from .manipulation import concat #DEFINE_ALIAS -# from .manipulation import expand #DEFINE_ALIAS -# from .manipulation import expand_as #DEFINE_ALIAS -# from .manipulation import flatten #DEFINE_ALIAS -from .manipulation import gather #DEFINE_ALIAS -# from .manipulation import gather_nd #DEFINE_ALIAS -# from .manipulation import reshape #DEFINE_ALIAS -# from .manipulation import reverse #DEFINE_ALIAS -# from .manipulation import scatter #DEFINE_ALIAS -# from .manipulation import scatter_nd_add #DEFINE_ALIAS -# from .manipulation import scatter_nd #DEFINE_ALIAS -# from .manipulation import shard_index #DEFINE_ALIAS -# from .manipulation import slice #DEFINE_ALIAS -from .manipulation import split #DEFINE_ALIAS -from .manipulation import squeeze #DEFINE_ALIAS -from .manipulation import stack #DEFINE_ALIAS -# from .manipulation import strided_slice #DEFINE_ALIAS -# from .manipulation import transpose #DEFINE_ALIAS -# from .manipulation import unique #DEFINE_ALIAS -# from .manipulation import unique_with_counts #DEFINE_ALIAS -from .manipulation import unsqueeze #DEFINE_ALIAS -# from .manipulation import unstack #DEFINE_ALIAS -from .manipulation import flip #DEFINE_ALIAS -# from .manipulation import unbind #DEFINE_ALIAS -from .manipulation import roll #DEFINE_ALIAS +from .math import kron #DEFINE_ALIAS +# from .random import gaussin #DEFINE_ALIAS +# from .random import uniform #DEFINE_ALIAS +from .random import shuffle #DEFINE_ALIAS +from .random import randn #DEFINE_ALIAS +from .random import rand #DEFINE_ALIAS +from .random import randint #DEFINE_ALIAS +from .random import randperm #DEFINE_ALIAS from .search import argmax #DEFINE_ALIAS -# from .search import argmin #DEFINE_ALIAS -# from .search import argsort #DEFINE_ALIAS -# from .search import has_inf #DEFINE_ALIAS -# from .search import has_nan #DEFINE_ALIAS -# from .search import masked_select #DEFINE_ALIAS -# from .search import topk #DEFINE_ALIAS +from .search import argmin #DEFINE_ALIAS +from .search import argsort #DEFINE_ALIAS +from .search import has_inf #DEFINE_ALIAS +from .search import has_nan #DEFINE_ALIAS +# from .search import masked_select #DEFINE_ALIAS +from .search import topk #DEFINE_ALIAS from .search import where #DEFINE_ALIAS from .search import index_select #DEFINE_ALIAS -from .search import index_sample # DEFINE_ALIAS from .search import nonzero #DEFINE_ALIAS from .search import sort #DEFINE_ALIAS +from .search import index_sample #DEFINE_ALIAS +from .stat import mean #DEFINE_ALIAS +from .stat import reduce_mean #DEFINE_ALIAS +from .stat import std #DEFINE_ALIAS +from .stat import var #DEFINE_ALIAS +# from .tensor import Tensor #DEFINE_ALIAS +# from .tensor import LoDTensor #DEFINE_ALIAS +# from .tensor import LoDTensorArray #DEFINE_ALIAS diff --git a/python/paddle/tensor/attribute.py b/python/paddle/tensor/attribute.py index ed6ac392e2..255557673c 100644 --- a/python/paddle/tensor/attribute.py +++ b/python/paddle/tensor/attribute.py @@ -13,4 +13,7 @@ # limitations under the License. # TODO: define functions to get tensor attributes -# __all__ = ['rank', 'shape'] +from ..fluid.layers import rank #DEFINE_ALIAS +from ..fluid.layers import shape #DEFINE_ALIAS + +__all__ = ['rank', 'shape'] diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 7a60f7d22c..8c66dd7005 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -23,18 +23,23 @@ from ..fluid.layers import fill_constant from paddle.common_ops_import import * # TODO: define functions to get create a tensor +from ..fluid.layers import crop_tensor #DEFINE_ALIAS +from ..fluid.layers import diag #DEFINE_ALIAS +from ..fluid.layers import eye #DEFINE_ALIAS +from ..fluid.layers import fill_constant #DEFINE_ALIAS + __all__ = [ - # 'create_tensor', - # 'create_lod_tensor', - # 'create_random_int_lodtensor', - # 'crop_tensor', - # 'diag', 'eye', - # 'fill_constant', - # 'get_tensor_from_selected_rows', + # 'create_tensor', + # 'create_lod_tensor', + # 'create_random_int_lodtensor', + 'crop_tensor', + 'diag', + 'eye', + 'fill_constant', + # 'get_tensor_from_selected_rows', 'linspace', 'ones', 'ones_like', - # 'range', 'zeros', 'zeros_like', 'arange', @@ -43,7 +48,7 @@ __all__ = [ 'full_like', 'triu', 'tril', - 'meshgrid', + 'meshgrid' ] diff --git a/python/paddle/tensor/io.py b/python/paddle/tensor/io.py index d5044f2d72..66e956e8e4 100644 --- a/python/paddle/tensor/io.py +++ b/python/paddle/tensor/io.py @@ -13,4 +13,7 @@ # limitations under the License. # TODO: define functions to save & load a tensor -# __all__ = ['save', 'load'] +from ..fluid import save #DEFINE_ALIAS +from ..fluid.io import load #DEFINE_ALIAS + +__all__ = ['save', 'load'] diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index d3264d68c6..080ca57325 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -17,17 +17,19 @@ from ..fluid.layer_helper import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype, check_type from ..fluid.framework import in_dygraph_mode, _varbase_creator +from ..fluid.layers import transpose #DEFINE_ALIAS + __all__ = [ 'matmul', 'dot', - # 'einsum', + # 'einsum', 'norm', - # 'transpose', + 'transpose', 'dist', 't', 'cross', 'cholesky', - # 'tensordot', + # 'tensordot', 'bmm' ] diff --git a/python/paddle/tensor/logic.py b/python/paddle/tensor/logic.py index c3b0d1ca17..f7ade866d3 100644 --- a/python/paddle/tensor/logic.py +++ b/python/paddle/tensor/logic.py @@ -17,24 +17,38 @@ from ..fluid.data_feeder import check_type from ..fluid.layers.layer_function_generator import templatedoc # TODO: define logic functions of a tensor +from ..fluid.layers import greater_equal #DEFINE_ALIAS +from ..fluid.layers import greater_than #DEFINE_ALIAS +from ..fluid.layers import is_empty #DEFINE_ALIAS +from ..fluid.layers import isfinite #DEFINE_ALIAS +from ..fluid.layers import less_equal #DEFINE_ALIAS +from ..fluid.layers import less_than #DEFINE_ALIAS +from ..fluid.layers import logical_and #DEFINE_ALIAS +from ..fluid.layers import logical_not #DEFINE_ALIAS +from ..fluid.layers import logical_or #DEFINE_ALIAS +from ..fluid.layers import logical_xor #DEFINE_ALIAS +from ..fluid.layers import not_equal #DEFINE_ALIAS +from ..fluid.layers import reduce_all #DEFINE_ALIAS +from ..fluid.layers import reduce_any #DEFINE_ALIAS + __all__ = [ 'equal', - # 'greater_equal', - # 'greater_than', - # 'is_empty', - # 'isfinite', - # 'less_equal', - # 'less_than', - # 'logical_and', - # 'logical_not', - # 'logical_or', - # 'logical_xor', - # 'not_equal', - # 'reduce_all', - # 'reduce_any', + 'greater_equal', + 'greater_than', + 'is_empty', + 'isfinite', + 'less_equal', + 'less_than', + 'logical_and', + 'logical_not', + 'logical_or', + 'logical_xor', + 'not_equal', + 'reduce_all', + 'reduce_any', 'allclose', 'elementwise_equal', - # 'isnan' + # 'isnan' ] diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index 4c982c4fab..af97730a8b 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -21,32 +21,46 @@ from ..fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_t from ..fluid.layers.tensor import fill_constant from ..fluid.layers import utils # TODO: define functions to manipulate a tensor +from ..fluid.layers import cast #DEFINE_ALIAS +from ..fluid.layers import concat #DEFINE_ALIAS +from ..fluid.layers import expand #DEFINE_ALIAS +from ..fluid.layers import expand_as #DEFINE_ALIAS +from ..fluid.layers import flatten #DEFINE_ALIAS +from ..fluid.layers import reshape #DEFINE_ALIAS +from ..fluid.layers import reverse #DEFINE_ALIAS +from ..fluid.layers import scatter #DEFINE_ALIAS +from ..fluid.layers import slice #DEFINE_ALIAS +from ..fluid.layers import strided_slice #DEFINE_ALIAS +from ..fluid.layers import transpose #DEFINE_ALIAS +from ..fluid.layers import unique #DEFINE_ALIAS +from ..fluid.layers import unstack #DEFINE_ALIAS + __all__ = [ - # 'cast', - # 'concat', - # 'expand', - # 'expand_as', - # 'flatten', + 'cast', + 'concat', + 'expand', + 'expand_as', + 'flatten', 'gather', - # 'gather_nd', - # 'reshape', - # 'reverse', - # 'scatter', - # 'scatter_nd_add', - # 'scatter_nd', - # 'shard_index', - # 'slice', + # 'gather_nd', + 'reshape', + 'reverse', + 'scatter', + # 'scatter_nd_add', + # 'scatter_nd', + # 'shard_index', + 'slice', 'split', 'squeeze', 'stack', - # 'strided_slice', - # 'transpose', - # 'unique', - # 'unique_with_counts', + 'strided_slice', + 'transpose', + 'unique', + # 'unique_with_counts', 'unsqueeze', - # 'unstack', + 'unstack', 'flip', - # 'unbind', + # 'unbind', 'roll' ] diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 8936d79723..4c10063237 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -25,62 +25,95 @@ import sys # TODO: define math functions # yapf: disable +from ..fluid.layers import abs #DEFINE_ALIAS +from ..fluid.layers import acos #DEFINE_ALIAS +from ..fluid.layers import asin #DEFINE_ALIAS +from ..fluid.layers import ceil #DEFINE_ALIAS +from ..fluid.layers import cos #DEFINE_ALIAS +from ..fluid.layers import cumsum #DEFINE_ALIAS +from ..fluid.layers import elementwise_add #DEFINE_ALIAS +from ..fluid.layers import elementwise_div #DEFINE_ALIAS +from ..fluid.layers import elementwise_floordiv #DEFINE_ALIAS +from ..fluid.layers import elementwise_max #DEFINE_ALIAS +from ..fluid.layers import elementwise_min #DEFINE_ALIAS +from ..fluid.layers import elementwise_mod #DEFINE_ALIAS +from ..fluid.layers import elementwise_mul #DEFINE_ALIAS +from ..fluid.layers import elementwise_pow #DEFINE_ALIAS +from ..fluid.layers import elementwise_sub #DEFINE_ALIAS +from ..fluid.layers import exp #DEFINE_ALIAS +from ..fluid.layers import floor #DEFINE_ALIAS +from ..fluid.layers import log #DEFINE_ALIAS +from ..fluid.layers import reciprocal #DEFINE_ALIAS +from ..fluid.layers import reduce_max #DEFINE_ALIAS +from ..fluid.layers import reduce_min #DEFINE_ALIAS +from ..fluid.layers import reduce_prod #DEFINE_ALIAS +from ..fluid.layers import reduce_sum #DEFINE_ALIAS +from ..fluid.layers import round #DEFINE_ALIAS +from ..fluid.layers import rsqrt #DEFINE_ALIAS +from ..fluid.layers import scale #DEFINE_ALIAS +from ..fluid.layers import sign #DEFINE_ALIAS +from ..fluid.layers import square #DEFINE_ALIAS +from ..fluid.layers import stanh #DEFINE_ALIAS +from ..fluid.layers import atan #DEFINE_ALIAS +from ..fluid.layers import erf #DEFINE_ALIAS + __all__ = [ -# 'abs', -# 'acos', -# 'asin', - 'atan', -# 'ceil', -# 'cos', -# 'cumsum', -# 'elementwise_add', -# 'elementwise_div', -# 'elementwise_floordiv', -# 'elementwise_max', -# 'elementwise_min', -# 'elementwise_mod', -# 'elementwise_mul', -# 'elementwise_pow', -# 'elementwise_sub', -# 'exp', -# 'floor', -# 'increment', -# 'log', - 'mul', -# 'multiplex', - 'pow', -# 'reciprocal', -# 'reduce_max', -# 'reduce_min', -# 'reduce_prod', -# 'reduce_sum', -# 'round', -# 'rsqrt', -# 'scale', -# 'sign', - 'sin', - 'sqrt', -# 'square', -# 'stanh', - 'sum', -# 'sums', - 'tanh', - 'elementwise_sum', - 'max', - 'min', - 'mm', - 'div', - 'add', -# 'atan', - 'logsumexp', -# 'inverse', - 'log1p', -# 'erf', - 'addcmul', - 'addmm', - 'clamp', - 'kron', + 'abs', + 'acos', + 'asin', + 'atan', + 'ceil', + 'cos', + 'cumsum', + 'elementwise_add', + 'elementwise_div', + 'elementwise_floordiv', + 'elementwise_max', + 'elementwise_min', + 'elementwise_mod', + 'elementwise_mul', + 'elementwise_pow', + 'elementwise_sub', + 'exp', + 'floor', +# 'increment', + 'log', + 'mul', +# 'multiplex', + 'pow', + 'reciprocal', + 'reduce_max', + 'reduce_min', + 'reduce_prod', + 'reduce_sum', + 'round', + 'rsqrt', + 'scale', + 'sign', + 'sin', + 'sqrt', + 'square', + 'stanh', + 'sum', +# 'sums', + 'tanh', + 'elementwise_sum', + 'max', + 'min', + 'mm', + 'div', + 'add', + 'atan', + 'logsumexp', +# 'inverse', + 'log1p', + 'erf', + 'addcmul', + 'addmm', + 'clamp', + 'kron' ] + # yapf: enable. diff --git a/python/paddle/tensor/random.py b/python/paddle/tensor/random.py index 62a43604de..74994dcc28 100644 --- a/python/paddle/tensor/random.py +++ b/python/paddle/tensor/random.py @@ -14,13 +14,6 @@ # TODO: define random functions -# __all__ = ['gaussin', -# 'uniform', -# 'shuffle', -# 'randn', -# 'rand', -# 'randint'] - import numpy as np from ..fluid import core @@ -31,7 +24,17 @@ from ..fluid.data_feeder import convert_dtype, check_variable_and_dtype, check_t from ..fluid.layers import uniform_random, utils from ..fluid.layers.tensor import fill_constant -__all__ = ['randperm', 'randn', 'randint', 'rand'] +from ..fluid.io import shuffle #DEFINE_ALIAS + +__all__ = [ + # 'gaussin', + # 'uniform', + 'shuffle', + 'randn', + 'rand', + 'randint', + 'randperm' +] def randint(low, diff --git a/python/paddle/tensor/search.py b/python/paddle/tensor/search.py index b27b223a26..fdb7fc248a 100644 --- a/python/paddle/tensor/search.py +++ b/python/paddle/tensor/search.py @@ -17,15 +17,21 @@ from ..fluid.layer_helper import LayerHelper from ..fluid.data_feeder import check_variable_and_dtype, check_type, check_dtype from ..fluid import core, layers -# TODO: define searching & indexing functions of a tensor +# TODO: define searching & indexing functions of a tensor +from ..fluid.layers import argmin #DEFINE_ALIAS +from ..fluid.layers import argsort #DEFINE_ALIAS +from ..fluid.layers import has_inf #DEFINE_ALIAS +from ..fluid.layers import has_nan #DEFINE_ALIAS +from ..fluid.layers import topk #DEFINE_ALIAS + __all__ = [ 'argmax', - # 'argmin', - # 'argsort', - # 'has_inf', - # 'has_nan', - # 'masked_select', - # 'topk', + 'argmin', + 'argsort', + 'has_inf', + 'has_nan', + # 'masked_select', + 'topk', 'where', 'index_select', 'nonzero', diff --git a/python/paddle/tensor/stat.py b/python/paddle/tensor/stat.py index 7275dc3242..7fdad6eb7d 100644 --- a/python/paddle/tensor/stat.py +++ b/python/paddle/tensor/stat.py @@ -13,11 +13,11 @@ # limitations under the License. # TODO: define statistical functions of a tensor -__all__ = [ #'mean', - #'reduce_mean', - 'std', - 'var' -] +from ..fluid.layers import mean #DEFINE_ALIAS +from ..fluid.layers import reduce_mean #DEFINE_ALIAS + +__all__ = ['mean', 'reduce_mean', 'std', 'var'] + import numpy as np from ..fluid.layer_helper import LayerHelper from ..fluid.framework import in_dygraph_mode diff --git a/python/paddle/tensor/tensor.py b/python/paddle/tensor/tensor.py index f501f3d258..478e826468 100644 --- a/python/paddle/tensor/tensor.py +++ b/python/paddle/tensor/tensor.py @@ -13,4 +13,9 @@ # limitations under the License. # TODO: define the basic tensor classes -# __all__ = ['Tensor', 'LoDTensor', 'LoDTensorArray'] + +__all__ = [ + # 'Tensor', + # 'LoDTensor', + # 'LoDTensorArray' +] -- GitLab