__init__.py 10.4 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.
L
Li Fuchen 已提交
17
__all__ = []
18 19

# TODO: define alias in functional directory
20
from . import conv
L
Li Fuchen 已提交
21
__all__ += conv.__all__
22
from . import activation
L
Li Fuchen 已提交
23
__all__ += activation.__all__
24 25 26 27
from . import extension
__all__ += extension.__all__
from . import common
__all__ += common.__all__
28 29
from . import pooling
__all__ += pooling.__all__
30 31
from . import loss
__all__ += loss.__all__
32
from .activation import elu  #DEFINE_ALIAS
33
from .activation import elu_  #DEFINE_ALIAS
34
# from .activation import erf  #DEFINE_ALIAS
35
from .activation import gelu  #DEFINE_ALIAS
36
from .activation import hardshrink  #DEFINE_ALIAS
37
from .activation import hardtanh  #DEFINE_ALIAS
38 39
from .activation import hardsigmoid  #DEFINE_ALIAS
from .activation import hardswish  #DEFINE_ALIAS
40
from .activation import leaky_relu  #DEFINE_ALIAS
41
from .activation import log_sigmoid  #DEFINE_ALIAS
42
from .activation import maxout  #DEFINE_ALIAS
43
from .activation import prelu  #DEFINE_ALIAS
44
from .activation import relu  #DEFINE_ALIAS
45
from .activation import relu_  #DEFINE_ALIAS
46 47
from .activation import relu6  #DEFINE_ALIAS
from .activation import selu  #DEFINE_ALIAS
48
from .activation import sigmoid  #DEFINE_ALIAS
49
# from .activation import soft_relu  #DEFINE_ALIAS
50
from .activation import softmax  #DEFINE_ALIAS
51
from .activation import softmax_  #DEFINE_ALIAS
52 53 54 55
from .activation import softplus  #DEFINE_ALIAS
from .activation import softshrink  #DEFINE_ALIAS
from .activation import softsign  #DEFINE_ALIAS
from .activation import swish  #DEFINE_ALIAS
W
WangXi 已提交
56
from .activation import tanh  #DEFINE_ALIAS
57
from .activation import tanh_  #DEFINE_ALIAS
58
from .activation import tanhshrink  #DEFINE_ALIAS
59
from .activation import thresholded_relu  #DEFINE_ALIAS
60
from .activation import log_softmax  #DEFINE_ALIAS
F
Feiyu Chan 已提交
61
from .activation import glu  #DEFINE_ALIAS
62
from .common import dropout  #DEFINE_ALIAS
63 64
from .common import dropout2d  #DEFINE_ALIAS
from .common import dropout3d  #DEFINE_ALIAS
65
from .common import alpha_dropout  #DEFINE_ALIAS
66
# from .common import embedding        #DEFINE_ALIAS
67
# from .common import fc  #DEFINE_ALIAS
68
from .common import label_smooth
69
# from .common import one_hot  #DEFINE_ALIAS
70
from .common import pad  #DEFINE_ALIAS
71 72
# from .common import pad_constant_like  #DEFINE_ALIAS
# from .common import pad2d  #DEFINE_ALIAS
L
littletomatodonkey 已提交
73
from .common import cosine_similarity  #DEFINE_ALIAS
74 75 76
from .common import unfold  #DEFINE_ALIAS
# from .common import bilinear_tensor_product        #DEFINE_ALIAS
from .common import interpolate  #DEFINE_ALIAS
77
from .common import upsample  #DEFINE_ALIAS
78
from .common import bilinear  #DEFINE_ALIAS
W
whs 已提交
79
from .conv import conv1d  #DEFINE_ALIAS
80
from .conv import conv1d_transpose  #DEFINE_ALIAS
81
from .common import linear  #DEFINE_ALIAS
82
from .conv import conv2d  #DEFINE_ALIAS
83
from .conv import conv2d_transpose  #DEFINE_ALIAS
84
from .conv import conv3d  #DEFINE_ALIAS
85
from .conv import conv3d_transpose  #DEFINE_ALIAS
86
# from .extension import add_position_encoding  #DEFINE_ALIAS
87
# from .extension import autoincreased_step_counter        #DEFINE_ALIAS
88 89
# from .extension import continuous_value_model  #DEFINE_ALIAS
# from .extension import filter_by_instag  #DEFINE_ALIAS
90 91
# from .extension import linear_chain_crf        #DEFINE_ALIAS
# from .extension import merge_selected_rows        #DEFINE_ALIAS
92 93 94 95 96 97 98 99
# 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 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
L
Li Fuchen 已提交
100
from .extension import diag_embed  #DEFINE_ALIAS
101
from .extension import sequence_mask
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
# 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
122
# from .lod import hash  #DEFINE_ALIAS
123 124 125 126 127 128 129 130
# 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
131
from .loss import binary_cross_entropy  #DEFINE_ALIAS
132
from .loss import binary_cross_entropy_with_logits  #DEFINE_ALIAS
133 134
# from .loss import bpr_loss  #DEFINE_ALIAS
# from .loss import center_loss  #DEFINE_ALIAS
135
#from .loss import cross_entropy  #DEFINE_ALIAS
136 137
from .loss import cross_entropy  #DEFINE_ALIAS
from .loss import dice_loss  #DEFINE_ALIAS
138
from .loss import hsigmoid_loss  #DEFINE_ALIAS
139
from .loss import kl_div  #DEFINE_ALIAS
140
from .loss import l1_loss  #DEFINE_ALIAS
141
from .loss import log_loss  #DEFINE_ALIAS
142
from .loss import margin_ranking_loss  #DEFINE_ALIAS
143
from .loss import mse_loss  #DEFINE_ALIAS
144
from .loss import nll_loss  #DEFINE_ALIAS
145 146 147
# from .loss import nce        #DEFINE_ALIAS
from .loss import npair_loss  #DEFINE_ALIAS
from .loss import sigmoid_focal_loss  #DEFINE_ALIAS
148
# from .loss import smooth_l1  #DEFINE_ALIAS
149
from .loss import smooth_l1_loss  #DEFINE_ALIAS
150 151
from .loss import softmax_with_cross_entropy  #DEFINE_ALIAS
from .loss import square_error_cost  #DEFINE_ALIAS
152
# from .loss import teacher_student_sigmoid_loss  #DEFINE_ALIAS
153
from .loss import ctc_loss  #DEFINE_ALIAS
154 155
# from .norm import data_norm        #DEFINE_ALIAS
# from .norm import group_norm        #DEFINE_ALIAS
156 157 158
from .norm import batch_norm  #DEFINE_ALIAS
from .norm import instance_norm  #DEFINE_ALIAS
from .norm import layer_norm  #DEFINE_ALIAS
159
from .norm import local_response_norm  #DEFINE_ALIAS
160
from .norm import normalize  #DEFINE_ALIAS
161
# from .norm import spectral_norm        #DEFINE_ALIAS
162 163
# from .pooling import pool2d  #DEFINE_ALIAS
# from .pooling import pool3d  #DEFINE_ALIAS
164
from .pooling import avg_pool1d  #DEFINE_ALIAS
165 166
from .pooling import avg_pool2d  #DEFINE_ALIAS
from .pooling import avg_pool3d  #DEFINE_ALIAS
167 168
from .pooling import max_pool1d  #DEFINE_ALIAS
from .pooling import max_pool2d  #DEFINE_ALIAS
169
from .pooling import max_pool3d  #DEFINE_ALIAS
170 171 172 173 174

from .pooling import adaptive_max_pool1d  #DEFINE_ALIAS
from .pooling import adaptive_max_pool2d  #DEFINE_ALIAS
from .pooling import adaptive_max_pool3d  #DEFINE_ALIAS
from .pooling import adaptive_avg_pool1d  #DEFINE_ALIAS
175 176
from .pooling import adaptive_avg_pool2d  #DEFINE_ALIAS
from .pooling import adaptive_avg_pool3d  #DEFINE_ALIAS
177

178 179
# from .rnn import rnn  #DEFINE_ALIAS
# from .rnn import birnn  #DEFINE_ALIAS
180 181 182
# from .rnn import gru_unit        #DEFINE_ALIAS
# from .rnn import lstm        #DEFINE_ALIAS
# from .rnn import lstm_unit        #DEFINE_ALIAS
183
# from .vision import affine_channel  #DEFINE_ALIAS
184
from .vision import affine_grid  #DEFINE_ALIAS
185 186 187 188 189 190
# 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
R
ruri 已提交
191
# from .vision import deformable_conv  #DEFINE_ALIAS
192 193 194 195 196 197 198 199
# 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
200
from .vision import grid_sample  #DEFINE_ALIAS
201 202
# from .vision import image_resize  #DEFINE_ALIAS
# from .vision import image_resize_short  #DEFINE_ALIAS
R
ruri 已提交
203
# from .vision import multi_box_head  #DEFINE_ALIAS
204
from .vision import pixel_shuffle  #DEFINE_ALIAS
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
# 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
220
from .input import one_hot  #DEFINE_ALIAS
T
tangwei12 已提交
221
from .input import embedding  #DEFINE_ALIAS
222
from ...fluid.layers import gather_tree
223
from ...fluid.layers import temporal_shift