__init__.py 7.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#   Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

15
# TODO: import all neural network related api under this directory,
16
# including layers, linear, conv, rnn etc.
17

18
from .layer import norm
L
Li Fuchen 已提交
19
from .functional import extension
20
from .layer import common
F
Feiyu Chan 已提交
21
from .layer import rnn
22
from .utils import weight_norm_hook
23

H
hong 已提交
24 25
from . import initializer

26 27
__all__ = []
__all__ += norm.__all__
L
Li Fuchen 已提交
28
__all__ += extension.__all__
29
__all__ += common.__all__
F
Feiyu Chan 已提交
30
__all__ += rnn.__all__
31
__all__ += weight_norm_hook.__all__
32

33
# TODO: define alias in nn directory
34 35 36
from .clip import ClipGradByGlobalNorm  #DEFINE_ALIAS
from .clip import ClipGradByNorm  #DEFINE_ALIAS
from .clip import ClipGradByValue  #DEFINE_ALIAS
37 38
# from .clip import set_gradient_clip        #DEFINE_ALIAS
from .clip import clip  #DEFINE_ALIAS
39
from .clip import clip_by_norm  #DEFINE_ALIAS
40
# from .control_flow import cond  #DEFINE_ALIAS
41 42
# from .control_flow import DynamicRNN        #DEFINE_ALIAS
# from .control_flow import StaticRNN        #DEFINE_ALIAS
43
# from .control_flow import while_loop  #DEFINE_ALIAS
44 45 46
# from .control_flow import rnn        #DEFINE_ALIAS
# from .decode import BeamSearchDecoder        #DEFINE_ALIAS
# from .decode import Decoder        #DEFINE_ALIAS
47 48
# from .decode import beam_search  #DEFINE_ALIAS
# from .decode import beam_search_decode  #DEFINE_ALIAS
49 50 51
# from .decode import crf_decoding        #DEFINE_ALIAS
# from .decode import ctc_greedy_decoder        #DEFINE_ALIAS
# from .decode import dynamic_decode        #DEFINE_ALIAS
52
# from .decode import gather_tree  #DEFINE_ALIAS
53
# from .input import Input        #DEFINE_ALIAS
54 55 56 57
from .layer.activation import ELU  #DEFINE_ALIAS
from .layer.activation import GELU  #DEFINE_ALIAS
from .layer.activation import Tanh  #DEFINE_ALIAS
from .layer.activation import Hardshrink  #DEFINE_ALIAS
58
from .layer.activation import Hardswish  #DEFINE_ALIAS
59 60 61
from .layer.activation import Hardtanh  #DEFINE_ALIAS
from .layer.activation import PReLU  #DEFINE_ALIAS
from .layer.activation import ReLU  #DEFINE_ALIAS
62 63
from .layer.activation import ReLU6  #DEFINE_ALIAS
from .layer.activation import SELU  #DEFINE_ALIAS
C
ceci3 已提交
64
from .layer.activation import LeakyReLU  #DEFINE_ALIAS
65
from .layer.activation import Sigmoid  #DEFINE_ALIAS
66
from .layer.activation import Hardsigmoid  #DEFINE_ALIAS
67
from .layer.activation import LogSigmoid
68
from .layer.activation import Softmax  #DEFINE_ALIAS
69 70 71
from .layer.activation import Softplus  #DEFINE_ALIAS
from .layer.activation import Softshrink  #DEFINE_ALIAS
from .layer.activation import Softsign  #DEFINE_ALIAS
72
from .layer.activation import Swish  #DEFINE_ALIAS
73
from .layer.activation import Tanhshrink  #DEFINE_ALIAS
74
from .layer.activation import ThresholdedReLU  #DEFINE_ALIAS
75
from .layer.activation import LogSoftmax  #DEFINE_ALIAS
76
from .layer.activation import Maxout  #DEFINE_ALIAS
L
littletomatodonkey 已提交
77 78 79 80 81 82 83 84 85 86
from .layer.common import ReflectionPad1d  #DEFINE_ALIAS
from .layer.common import ReplicationPad1d  #DEFINE_ALIAS
from .layer.common import ConstantPad1d  #DEFINE_ALIAS
from .layer.common import ReflectionPad2d  #DEFINE_ALIAS
from .layer.common import ReplicationPad2d  #DEFINE_ALIAS
from .layer.common import ConstantPad2d  #DEFINE_ALIAS
from .layer.common import ZeroPad2d  #DEFINE_ALIAS
from .layer.common import ReplicationPad3d  #DEFINE_ALIAS
from .layer.common import ConstantPad3d  #DEFINE_ALIAS
from .layer.common import CosineSimilarity  #DEFINE_ALIAS
87 88
from .layer.common import Embedding  #DEFINE_ALIAS
from .layer.common import Linear  #DEFINE_ALIAS
89
from .layer.common import Flatten  #DEFINE_ALIAS
90
from .layer.common import Upsample  #DEFINE_ALIAS
X
xiaoting 已提交
91 92
from .layer.common import UpsamplingNearest2d  #DEFINE_ALIAS
from .layer.common import UpsamplingBilinear2d  #DEFINE_ALIAS
93
from .layer.common import Bilinear  #DEFINE_ALIAS
94
from .layer.common import Dropout  #DEFINE_ALIAS
95 96
from .layer.common import Dropout2d  #DEFINE_ALIAS
from .layer.common import Dropout3d  #DEFINE_ALIAS
97
from .layer.common import AlphaDropout  #DEFINE_ALIAS
98 99 100 101 102 103 104 105

from .layer.pooling import AvgPool1d  #DEFINE_ALIAS
from .layer.pooling import AvgPool2d  #DEFINE_ALIAS
from .layer.pooling import AvgPool3d  #DEFINE_ALIAS
from .layer.pooling import MaxPool1d  #DEFINE_ALIAS
from .layer.pooling import MaxPool2d  #DEFINE_ALIAS
from .layer.pooling import MaxPool3d  #DEFINE_ALIAS
from .layer.pooling import AdaptiveAvgPool1d  #DEFINE_ALIAS
106 107
from .layer.pooling import AdaptiveAvgPool2d  #DEFINE_ALIAS
from .layer.pooling import AdaptiveAvgPool3d  #DEFINE_ALIAS
108 109 110 111

from .layer.pooling import AdaptiveMaxPool1d  #DEFINE_ALIAS
from .layer.pooling import AdaptiveMaxPool2d  #DEFINE_ALIAS
from .layer.pooling import AdaptiveMaxPool3d  #DEFINE_ALIAS
W
whs 已提交
112
from .layer.conv import Conv1d  #DEFINE_ALIAS
113 114
from .layer.conv import Conv2d  #DEFINE_ALIAS
from .layer.conv import Conv3d  #DEFINE_ALIAS
115
from .layer.conv import ConvTranspose1d  #DEFINE_ALIAS
L
LielinJiang 已提交
116 117
from .layer.conv import ConvTranspose2d  #DEFINE_ALIAS
from .layer.conv import ConvTranspose3d  #DEFINE_ALIAS
118 119 120
# from .layer.conv import TreeConv        #DEFINE_ALIAS
# from .layer.conv import Conv1D        #DEFINE_ALIAS
from .layer.extension import RowConv  #DEFINE_ALIAS
121
from .layer.common import Linear
122
# from .layer.loss import NCELoss        #DEFINE_ALIAS
123
from .layer.loss import BCEWithLogitsLoss  #DEFINE_ALIAS
124
from .layer.loss import CrossEntropyLoss  #DEFINE_ALIAS
125
from .layer.loss import HSigmoidLoss  #DEFINE_ALIAS
126
from .layer.loss import MSELoss  #DEFINE_ALIAS
L
Leo Chen 已提交
127
from .layer.loss import L1Loss  #DEFINE_ALIAS
128
from .layer.loss import NLLLoss  #DEFINE_ALIAS
C
ceci3 已提交
129
from .layer.loss import BCELoss  #DEFINE_ALIAS
130
from .layer.loss import KLDivLoss  #DEFINE_ALIAS
131
from .layer.loss import MarginRankingLoss  #DEFINE_ALIAS
132
from .layer.loss import CTCLoss  #DEFINE_ALIAS
133
from .layer.loss import SmoothL1Loss  #DEFINE_ALIAS
134
from .layer.norm import BatchNorm  #DEFINE_ALIAS
C
ceci3 已提交
135
from .layer.norm import SyncBatchNorm  #DEFINE_ALIAS
136 137 138
from .layer.norm import GroupNorm  #DEFINE_ALIAS
from .layer.norm import LayerNorm  #DEFINE_ALIAS
from .layer.norm import SpectralNorm  #DEFINE_ALIAS
139 140 141 142 143 144
from .layer.norm import InstanceNorm1d  #DEFINE_ALIAS
from .layer.norm import InstanceNorm2d  #DEFINE_ALIAS
from .layer.norm import InstanceNorm3d  #DEFINE_ALIAS
from .layer.norm import BatchNorm1d  #DEFINE_ALIAS
from .layer.norm import BatchNorm2d  #DEFINE_ALIAS
from .layer.norm import BatchNorm3d  #DEFINE_ALIAS
145
from .layer.norm import LocalResponseNorm  #DEFINE_ALIAS
146 147 148 149 150 151 152 153 154 155 156

from .layer.rnn import RNNCellBase  #DEFINE_ALIAS
from .layer.rnn import SimpleRNNCell  #DEFINE_ALIAS
from .layer.rnn import LSTMCell  #DEFINE_ALIAS
from .layer.rnn import GRUCell  #DEFINE_ALIAS
from .layer.rnn import RNN  #DEFINE_ALIAS
from .layer.rnn import BiRNN  #DEFINE_ALIAS
from .layer.rnn import SimpleRNN  #DEFINE_ALIAS
from .layer.rnn import LSTM  #DEFINE_ALIAS
from .layer.rnn import GRU  #DEFINE_ALIAS

157 158 159 160 161 162
from .layer.transformer import MultiHeadAttention
from .layer.transformer import TransformerEncoderLayer
from .layer.transformer import TransformerEncoder
from .layer.transformer import TransformerDecoderLayer
from .layer.transformer import TransformerDecoder
from .layer.transformer import Transformer
163
from .layer.distance import PairwiseDistance  #DEFINE_ALIAS
164

R
ruri 已提交
165 166
from .layer.vision import PixelShuffle

167 168
from .layer import loss  #DEFINE_ALIAS
from .layer import conv  #DEFINE_ALIAS
R
ruri 已提交
169
from .layer import vision  #DEFINE_ALIAS
170
from ..fluid.dygraph.layers import Layer  #DEFINE_ALIAS
H
hong 已提交
171
from ..fluid.dygraph.container import LayerList, ParameterList, Sequential  #DEFINE_ALIAS