SYMBOL INDEX (753 symbols across 77 files) FILE: Pytorch/B站-Pytorch与深度学习-代码/minist.py class MnistDataset (line 11) | class MnistDataset(Dataset): method __init__ (line 13) | def __init__(self, image_path, image_label, transform=None): method __getitem__ (line 19) | def __getitem__(self, index): method __len__ (line 32) | def __len__(self): function get_path_label (line 36) | def get_path_label(img_root, label_file_path): class ConvNet (line 80) | class ConvNet(nn.Module): method __init__ (line 81) | def __init__(self, num_classes=10): method forward (line 96) | def forward(self, x): FILE: Pytorch/B站-Pytorch与深度学习-代码/线性回归/dasou_mlp.py class DasouDataset (line 11) | class DasouDataset(Dataset): method __init__ (line 12) | def __init__(self, filepath): ## 加载原始数据集,并对特征数据和lable数据进行拆分 method __getitem__ (line 18) | def __getitem__(self, index): ## 根据索引返回单一样本数据 method __len__ (line 21) | def __len__(self): ## 返回长度 class Model (line 29) | class Model(torch.nn.Module): method __init__ (line 30) | def __init__(self): method forward (line 37) | def forward(self, x): FILE: Pytorch/B站-Pytorch与深度学习-代码/线性回归/sigmoid.py class DasouDataset (line 9) | class DasouDataset(Dataset): method __init__ (line 10) | def __init__(self, filepath): ## 加载原始数据集,并对特征数据和lable数据进行拆分 method __getitem__ (line 16) | def __getitem__(self, index):## 根据索引返回单一样本数据 method __len__ (line 19) | def __len__(self):## 返回长度 class Model (line 28) | class Model(torch.nn.Module): method __init__ (line 29) | def __init__(self): method forward (line 36) | def forward(self, x): FILE: 深度学习自然语言处理/文本匹配和文本相似度/src/ESIM-attention/process.py function get_mask (line 17) | def get_mask(sequences_batch, sequences_lengths): function sort_by_seq_lens (line 35) | def sort_by_seq_lens(batch, sequences_lengths, descending=True): class Seq2SeqEncoder (line 46) | class Seq2SeqEncoder(nn.Module): method __init__ (line 47) | def __init__(self, rnn_type, input_size, hidden_size, num_layers=1, bi... method forward (line 61) | def forward(self, sequences_batch, sequences_lengths): function masked_softmax (line 99) | def masked_softmax(tensor, mask): function weighted_sum (line 115) | def weighted_sum(tensor, weights, mask): class SoftmaxAttention (line 127) | class SoftmaxAttention(nn.Module): method forward (line 129) | def forward(self, premise_batch, premise_mask, hypothesis_batch, hypot... function replace_masked (line 160) | def replace_masked(tensor, mask, value): FILE: 深度学习自然语言处理/文本匹配和文本相似度/src/models.py class ESIM (line 1) | class ESIM(nn.Module): method __init__ (line 2) | def __init__(self, config_base): method forward (line 28) | def forward(self, q1, q1_lengths, q2, q2_lengths): class SiaGRU (line 69) | class SiaGRU(nn.Module): method __init__ (line 70) | def __init__(self, config_base): method init_hidden (line 85) | def init_hidden(self, size): method forward_once (line 90) | def forward_once(self, x): method dropout (line 94) | def dropout(self, v): method forward (line 97) | def forward(self, q1, q1_lengths, q2, q2_lengths): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/docs/source/conf.py function setup (line 211) | def setup(app): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/bin/average_models.py function average_models (line 6) | def average_models(model_files, fp32=False): function main (line 39) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/bin/preprocess.py function check_existing_pt_files (line 24) | def check_existing_pt_files(opt, corpus_type, ids, existing_fields): function process_one_shard (line 46) | def process_one_shard(corpus_params, params): function maybe_load_vocab (line 108) | def maybe_load_vocab(corpus_type, counters, opt): function build_save_dataset (line 129) | def build_save_dataset(corpus_type, fields, src_reader, tgt_reader, function build_save_vocab (line 218) | def build_save_vocab(train_dataset, fields, opt): function count_features (line 229) | def count_features(path): function preprocess (line 240) | def preprocess(opt): function _get_parser (line 281) | def _get_parser(): function main (line 289) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/bin/server.py function start (line 11) | def start(config_file, function _get_parser (line 116) | def _get_parser(): function main (line 129) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/bin/train.py function train (line 20) | def train(opt): function batch_producer (line 93) | def batch_producer(generator_to_serve, queues, semaphore, opt): function run (line 139) | def run(opt, device_id, error_queue, batch_queue, semaphore): class ErrorHandler (line 155) | class ErrorHandler(object): method __init__ (line 159) | def __init__(self, error_queue): method add_child (line 170) | def add_child(self, pid): method error_listener (line 174) | def error_listener(self): method signal_handler (line 180) | def signal_handler(self, signalnum, stackframe): function _get_parser (line 191) | def _get_parser(): function main (line 200) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/bin/translate.py function translate (line 14) | def translate(opt): function _get_parser (line 36) | def _get_parser(): function main (line 44) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/decoders/cnn_decoder.py class CNNDecoder (line 14) | class CNNDecoder(DecoderBase): method __init__ (line 21) | def __init__(self, num_layers, hidden_size, attn_type, method from_opt (line 52) | def from_opt(cls, opt, embeddings): method init_state (line 64) | def init_state(self, _, memory_bank, enc_hidden): method map_state (line 69) | def map_state(self, fn): method detach_state (line 74) | def detach_state(self): method forward (line 77) | def forward(self, tgt, memory_bank, step=None, **kwargs): method update_dropout (line 131) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/decoders/decoder.py class DecoderBase (line 11) | class DecoderBase(nn.Module): method __init__ (line 18) | def __init__(self, attentional=True): method from_opt (line 23) | def from_opt(cls, opt, embeddings): class RNNDecoderBase (line 32) | class RNNDecoderBase(DecoderBase): method __init__ (line 83) | def __init__(self, rnn_type, bidirectional_encoder, num_layers, method from_opt (line 142) | def from_opt(cls, opt, embeddings): method init_state (line 160) | def init_state(self, src, memory_bank, encoder_final): method map_state (line 183) | def map_state(self, fn): method detach_state (line 189) | def detach_state(self): method forward (line 193) | def forward(self, tgt, memory_bank, memory_lengths=None, step=None, method update_dropout (line 238) | def update_dropout(self, dropout): class StdRNNDecoder (line 243) | class StdRNNDecoder(RNNDecoderBase): method _run_forward_pass (line 259) | def _run_forward_pass(self, tgt, memory_bank, memory_lengths=None): method _build_rnn (line 322) | def _build_rnn(self, rnn_type, **kwargs): method _input_size (line 327) | def _input_size(self): class InputFeedRNNDecoder (line 331) | class InputFeedRNNDecoder(RNNDecoderBase): method _run_forward_pass (line 359) | def _run_forward_pass(self, tgt, memory_bank, memory_lengths=None): method _build_rnn (line 425) | def _build_rnn(self, rnn_type, input_size, method _input_size (line 433) | def _input_size(self): method update_dropout (line 437) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/decoders/ensemble.py class EnsembleDecoderOutput (line 17) | class EnsembleDecoderOutput(object): method __init__ (line 19) | def __init__(self, model_dec_outs): method squeeze (line 22) | def squeeze(self, dim=None): method __getitem__ (line 29) | def __getitem__(self, index): class EnsembleEncoder (line 33) | class EnsembleEncoder(EncoderBase): method __init__ (line 35) | def __init__(self, model_encoders): method forward (line 39) | def forward(self, src, lengths=None): class EnsembleDecoder (line 46) | class EnsembleDecoder(DecoderBase): method __init__ (line 48) | def __init__(self, model_decoders): method forward (line 54) | def forward(self, tgt, memory_bank, memory_lengths=None, step=None, method combine_attns (line 69) | def combine_attns(self, attns): method init_state (line 76) | def init_state(self, src, memory_bank, enc_hidden): method map_state (line 81) | def map_state(self, fn): class EnsembleGenerator (line 86) | class EnsembleGenerator(nn.Module): method __init__ (line 91) | def __init__(self, model_generators, raw_probs=False): method forward (line 96) | def forward(self, hidden, attn=None, src_map=None): class EnsembleModel (line 112) | class EnsembleModel(NMTModel): method __init__ (line 114) | def __init__(self, models, raw_probs=False): function load_test_model (line 123) | def load_test_model(opt): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/decoders/transformer.py class TransformerDecoderLayer (line 14) | class TransformerDecoderLayer(nn.Module): method __init__ (line 26) | def __init__(self, d_model, heads, d_ff, dropout, attention_dropout, method forward (line 50) | def forward(self, *args, **kwargs): method _forward (line 85) | def _forward(self, inputs, memory_bank, src_pad_mask, tgt_pad_mask, method update_dropout (line 143) | def update_dropout(self, dropout, attention_dropout): class TransformerDecoder (line 150) | class TransformerDecoder(DecoderBase): method __init__ (line 180) | def __init__(self, num_layers, d_model, heads, d_ff, method from_opt (line 210) | def from_opt(cls, opt, embeddings): method init_state (line 229) | def init_state(self, src, memory_bank, enc_hidden): method map_state (line 234) | def map_state(self, fn): method detach_state (line 247) | def detach_state(self): method forward (line 250) | def forward(self, tgt, memory_bank, step=None, **kwargs): method _init_cache (line 300) | def _init_cache(self, memory_bank): method update_dropout (line 315) | def update_dropout(self, dropout, attention_dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/audio_encoder.py class AudioEncoder (line 13) | class AudioEncoder(EncoderBase): method __init__ (line 30) | def __init__(self, rnn_type, enc_layers, dec_layers, brnn, method from_opt (line 85) | def from_opt(cls, opt, embeddings=None): method forward (line 101) | def forward(self, src, lengths=None): method update_dropout (line 143) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/cnn_encoder.py class CNNEncoder (line 12) | class CNNEncoder(EncoderBase): method __init__ (line 17) | def __init__(self, num_layers, hidden_size, method from_opt (line 28) | def from_opt(cls, opt, embeddings): method forward (line 37) | def forward(self, input, lengths=None, hidden=None): method update_dropout (line 54) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/encoder.py class EncoderBase (line 8) | class EncoderBase(nn.Module): method from_opt (line 34) | def from_opt(cls, opt, embeddings=None): method _check_args (line 37) | def _check_args(self, src, lengths=None, hidden=None): method forward (line 43) | def forward(self, src, lengths=None): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/image_encoder.py class ImageEncoder (line 9) | class ImageEncoder(EncoderBase): method __init__ (line 19) | def __init__(self, num_layers, bidirectional, rnn_size, dropout, method from_opt (line 52) | def from_opt(cls, opt, embeddings=None): method load_pretrained_vectors (line 69) | def load_pretrained_vectors(self, opt): method forward (line 73) | def forward(self, src, lengths=None): method update_dropout (line 130) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/mean_encoder.py class MeanEncoder (line 7) | class MeanEncoder(EncoderBase): method __init__ (line 15) | def __init__(self, num_layers, embeddings): method from_opt (line 21) | def from_opt(cls, opt, embeddings): method forward (line 27) | def forward(self, src, lengths=None): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/rnn_encoder.py class RNNEncoder (line 12) | class RNNEncoder(EncoderBase): method __init__ (line 25) | def __init__(self, rnn_type, bidirectional, num_layers, method from_opt (line 52) | def from_opt(cls, opt, embeddings): method forward (line 63) | def forward(self, src, lengths=None): method _initialize_bridge (line 85) | def _initialize_bridge(self, rnn_type, method _bridge (line 100) | def _bridge(self, hidden): method update_dropout (line 117) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/encoders/transformer.py class TransformerEncoderLayer (line 13) | class TransformerEncoderLayer(nn.Module): method __init__ (line 26) | def __init__(self, d_model, heads, d_ff, dropout, attention_dropout, method forward (line 37) | def forward(self, inputs, mask): method update_dropout (line 54) | def update_dropout(self, dropout, attention_dropout): class TransformerEncoder (line 60) | class TransformerEncoder(EncoderBase): method __init__ (line 91) | def __init__(self, num_layers, d_model, heads, d_ff, dropout, method from_opt (line 104) | def from_opt(cls, opt, embeddings): method forward (line 117) | def forward(self, src, lengths=None): method update_dropout (line 132) | def update_dropout(self, dropout, attention_dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/audio_dataset.py class AudioDataReader (line 19) | class AudioDataReader(DataReaderBase): method __init__ (line 38) | def __init__(self, sample_rate=0, window_size=0, window_stride=0, method from_opt (line 49) | def from_opt(cls, opt): method _check_deps (line 54) | def _check_deps(cls): method extract_features (line 59) | def extract_features(self, audio_path): method read (line 96) | def read(self, data, side, src_dir=None): function audio_sort_key (line 131) | def audio_sort_key(ex): class AudioSeqField (line 136) | class AudioSeqField(Field): method __init__ (line 142) | def __init__(self, preprocessing=None, postprocessing=None, method pad (line 155) | def pad(self, minibatch): method numericalize (line 182) | def numericalize(self, arr, device=None): function audio_fields (line 220) | def audio_fields(**kwargs): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/datareader_base.py class MissingDependencyException (line 6) | class MissingDependencyException(Exception): class DataReaderBase (line 10) | class DataReaderBase(object): method from_opt (line 20) | def from_opt(cls, opt): method _read_file (line 30) | def _read_file(cls, path): method _raise_missing_dep (line 37) | def _raise_missing_dep(*missing_deps): method read (line 43) | def read(self, data, side, src_dir): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/dataset_base.py function _join_dicts (line 12) | def _join_dicts(*args): function _dynamic_dict (line 24) | def _dynamic_dict(example, src_field, tgt_field): class Dataset (line 63) | class Dataset(TorchtextDataset): method __init__ (line 110) | def __init__(self, fields, readers, data, dirs, sort_key, method __getattr__ (line 142) | def __getattr__(self, attr): method save (line 151) | def save(self, path, remove_fields=True): method config (line 157) | def config(fields): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/image_dataset.py class ImageDataReader (line 19) | class ImageDataReader(DataReaderBase): method __init__ (line 32) | def __init__(self, truncate=None, channel_size=3): method from_opt (line 38) | def from_opt(cls, opt): method _check_deps (line 42) | def _check_deps(cls): method read (line 47) | def read(self, images, side, img_dir=None): function img_sort_key (line 86) | def img_sort_key(ex): function batch_img (line 91) | def batch_img(data, vocab): function image_fields (line 102) | def image_fields(**kwargs): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/inputter.py function _getstate (line 30) | def _getstate(self): function _setstate (line 34) | def _setstate(self, state): function make_src (line 43) | def make_src(data, vocab): function make_tgt (line 53) | def make_tgt(data, vocab): class AlignField (line 61) | class AlignField(LabelField): method __init__ (line 65) | def __init__(self, **kwargs): method process (line 70) | def process(self, batch, device=None): function parse_align_idx (line 84) | def parse_align_idx(align_pharaoh): function get_fields (line 101) | def get_fields( function load_old_vocab (line 188) | def load_old_vocab(vocab, data_type="text", dynamic_dict=False): function _old_style_vocab (line 240) | def _old_style_vocab(vocab): function _old_style_nesting (line 259) | def _old_style_nesting(vocab): function _old_style_field_list (line 265) | def _old_style_field_list(vocab): function old_style_vocab (line 284) | def old_style_vocab(vocab): function filter_example (line 290) | def filter_example(ex, use_src_len=True, use_tgt_len=True, function _pad_vocab_to_multiple (line 318) | def _pad_vocab_to_multiple(vocab, multiple): function _build_field_vocab (line 329) | def _build_field_vocab(field, counter, size_multiple=1, **kwargs): function _load_vocab (line 340) | def _load_vocab(vocab_path, name, counters, min_freq): function _build_fv_from_multifield (line 352) | def _build_fv_from_multifield(multifield, counters, build_fv_args, function _build_fields_vocab (line 363) | def _build_fields_vocab(fields, counters, data_type, share_vocab, function build_vocab (line 399) | def build_vocab(train_dataset_files, fields, data_type, share_vocab, function _merge_field_vocabs (line 492) | def _merge_field_vocabs(src_field, tgt_field, vocab_size, min_freq, function _read_vocab_file (line 512) | def _read_vocab_file(vocab_path, tag): function batch_iter (line 533) | def batch_iter(data, batch_size, batch_size_fn=None, batch_size_multiple... function _pool (line 571) | def _pool(data, batch_size, batch_size_fn, batch_size_multiple, class OrderedIterator (line 585) | class OrderedIterator(torchtext.data.Iterator): method __init__ (line 587) | def __init__(self, method create_batches (line 600) | def create_batches(self): method __iter__ (line 626) | def __iter__(self): class MultipleDatasetIterator (line 659) | class MultipleDatasetIterator(object): method __init__ (line 664) | def __init__(self, method _iter_datasets (line 688) | def _iter_datasets(self): method _iter_examples (line 697) | def _iter_examples(self): method __iter__ (line 701) | def __iter__(self): class DatasetLazyIter (line 717) | class DatasetLazyIter(object): method __init__ (line 730) | def __init__(self, dataset_paths, fields, batch_size, batch_size_fn, method _iter_dataset (line 745) | def _iter_dataset(self, path): method __iter__ (line 774) | def __iter__(self): function max_tok_len (line 798) | def max_tok_len(new, count, sofar): function build_dataset_iter (line 819) | def build_dataset_iter(corpus_type, fields, opt, is_train=True, multi=Fa... function build_dataset_iter_multiple (line 858) | def build_dataset_iter_multiple(train_shards, fields, opt): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/text_dataset.py class TextDataReader (line 11) | class TextDataReader(DataReaderBase): method read (line 12) | def read(self, sequences, side, _dir=None): function text_sort_key (line 38) | def text_sort_key(ex): function _feature_tokenize (line 46) | def _feature_tokenize( class TextMultiField (line 72) | class TextMultiField(RawField): method __init__ (line 91) | def __init__(self, base_name, base_field, feats_fields): method base_field (line 98) | def base_field(self): method process (line 101) | def process(self, batch, device=None): method preprocess (line 136) | def preprocess(self, x): method __getitem__ (line 150) | def __getitem__(self, item): function text_fields (line 154) | def text_fields(**kwargs): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/inputters/vec_dataset.py class VecDataReader (line 14) | class VecDataReader(DataReaderBase): method __init__ (line 21) | def __init__(self): method _check_deps (line 25) | def _check_deps(cls): method read (line 29) | def read(self, vecs, side, vec_dir=None): function vec_sort_key (line 60) | def vec_sort_key(ex): class VecSeqField (line 65) | class VecSeqField(Field): method __init__ (line 70) | def __init__(self, preprocessing=None, postprocessing=None, method pad (line 83) | def pad(self, minibatch): method numericalize (line 112) | def numericalize(self, arr, device=None): function vec_fields (line 147) | def vec_fields(**kwargs): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/model_builder.py function build_embeddings (line 23) | def build_embeddings(opt, text_field, for_encoder=True): function build_encoder (line 67) | def build_encoder(opt, embeddings): function build_decoder (line 79) | def build_decoder(opt, embeddings): function load_test_model (line 91) | def load_test_model(opt, model_path=None): function build_base_model (line 117) | def build_base_model(model_opt, fields, gpu, checkpoint=None, gpu_id=None): function build_model (line 238) | def build_model(model_opt, opt, fields, checkpoint): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/models/model.py class NMTModel (line 5) | class NMTModel(nn.Module): method __init__ (line 15) | def __init__(self, encoder, decoder): method forward (line 20) | def forward(self, src, tgt, lengths, bptt=False, with_align=False): method update_dropout (line 54) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/models/model_saver.py function build_model_saver (line 10) | def build_model_saver(model_opt, opt, model, fields, optim): class ModelSaverBase (line 20) | class ModelSaverBase(object): method __init__ (line 28) | def __init__(self, base_path, model, model_opt, fields, optim, method save (line 40) | def save(self, step, moving_average=None): method _save (line 71) | def _save(self, step): method _rm_checkpoint (line 86) | def _rm_checkpoint(self, name): class ModelSaver (line 97) | class ModelSaver(ModelSaverBase): method _save (line 100) | def _save(self, step, model): method _rm_checkpoint (line 133) | def _rm_checkpoint(self, name): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/models/sru.py class CheckSRU (line 16) | class CheckSRU(configargparse.Action): method __init__ (line 17) | def __init__(self, option_strings, dest, **kwargs): method __call__ (line 20) | def __call__(self, parser, namespace, values, option_string=None): function check_sru_requirement (line 32) | def check_sru_requirement(abort=False): function load_sru_mod (line 353) | def load_sru_mod(): class SRU_Compute (line 379) | class SRU_Compute(Function): method __init__ (line 381) | def __init__(self, activation_type, d_out, bidirectional=False): method maybe_load_sru_mod (line 389) | def maybe_load_sru_mod(): method forward (line 395) | def forward(self, u, x, bias, init=None, mask_h=None): method backward (line 440) | def backward(self, grad_h, grad_last): class SRUCell (line 493) | class SRUCell(nn.Module): method __init__ (line 494) | def __init__(self, n_in, n_out, dropout=0, rnn_dropout=0, method init_weight (line 516) | def init_weight(self): method set_bias (line 521) | def set_bias(self, bias_val=0): method forward (line 528) | def forward(self, input, c0=None): method get_dropout_mask_ (line 562) | def get_dropout_mask_(self, size, p): class SRU (line 567) | class SRU(nn.Module): method __init__ (line 588) | def __init__(self, input_size, hidden_size, method set_bias (line 616) | def set_bias(self, bias_val=0): method forward (line 620) | def forward(self, input, c0=None, return_hidden=True): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/models/stacked_rnn.py class StackedLSTM (line 6) | class StackedLSTM(nn.Module): method __init__ (line 12) | def __init__(self, num_layers, input_size, rnn_size, dropout): method forward (line 22) | def forward(self, input_feed, hidden): class StackedGRU (line 39) | class StackedGRU(nn.Module): method __init__ (line 45) | def __init__(self, num_layers, input_size, rnn_size, dropout): method forward (line 55) | def forward(self, input_feed, hidden): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/average_attn.py class AverageAttention (line 10) | class AverageAttention(nn.Module): method __init__ (line 22) | def __init__(self, model_dim, dropout=0.1, aan_useffn=False): method cumulative_average_mask (line 31) | def cumulative_average_mask(self, batch_size, inputs_len, device): method cumulative_average (line 54) | def cumulative_average(self, inputs, mask_or_step, method forward (line 84) | def forward(self, inputs, mask=None, layer_cache=None, step=None): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/conv_multi_step_attention.py function seq_linear (line 11) | def seq_linear(linear, x): class ConvMultiStepAttention (line 19) | class ConvMultiStepAttention(nn.Module): method __init__ (line 27) | def __init__(self, input_size): method apply_mask (line 32) | def apply_mask(self, mask): method forward (line 36) | def forward(self, base_target_emb, input_from_dec, encoder_out_top, FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/copy_generator.py function collapse_copy_scores (line 8) | def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs=None, class CopyGenerator (line 42) | class CopyGenerator(nn.Module): method __init__ (line 89) | def __init__(self, input_size, output_size, pad_idx): method forward (line 95) | def forward(self, hidden, attn, src_map): class CopyGeneratorLoss (line 135) | class CopyGeneratorLoss(nn.Module): method __init__ (line 137) | def __init__(self, vocab_size, force_copy, unk_index=0, method forward (line 146) | def forward(self, scores, align, target): class CopyGeneratorLossCompute (line 180) | class CopyGeneratorLossCompute(NMTLossCompute): method __init__ (line 182) | def __init__(self, criterion, generator, tgt_vocab, normalize_by_length, method _make_shard_state (line 189) | def _make_shard_state(self, batch, output, range_, attns): method _compute_loss (line 204) | def _compute_loss(self, batch, output, target, copy_attn, align, FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/embeddings.py class PositionalEncoding (line 11) | class PositionalEncoding(nn.Module): method __init__ (line 22) | def __init__(self, dropout, dim, max_len=5000): method forward (line 38) | def forward(self, emb, step=None): class VecEmbedding (line 57) | class VecEmbedding(nn.Module): method __init__ (line 58) | def __init__(self, vec_size, method forward (line 71) | def forward(self, x, step=None): method load_pretrained_vectors (line 85) | def load_pretrained_vectors(self, file): class Embeddings (line 89) | class Embeddings(nn.Module): method __init__ (line 129) | def __init__(self, word_vec_size, method _validate_args (line 205) | def _validate_args(self, feat_merge, feat_vocab_sizes, feat_vec_exponent, method word_lut (line 233) | def word_lut(self): method emb_luts (line 238) | def emb_luts(self): method load_pretrained_vectors (line 242) | def load_pretrained_vectors(self, emb_file): method forward (line 260) | def forward(self, source, step=None): method update_dropout (line 281) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/gate.py function context_gate_factory (line 6) | def context_gate_factory(gate_type, embeddings_size, decoder_size, class ContextGate (line 20) | class ContextGate(nn.Module): method __init__ (line 29) | def __init__(self, embeddings_size, decoder_size, method forward (line 39) | def forward(self, prev_emb, dec_state, attn_state): class SourceContextGate (line 48) | class SourceContextGate(nn.Module): method __init__ (line 51) | def __init__(self, embeddings_size, decoder_size, method forward (line 58) | def forward(self, prev_emb, dec_state, attn_state): class TargetContextGate (line 64) | class TargetContextGate(nn.Module): method __init__ (line 67) | def __init__(self, embeddings_size, decoder_size, method forward (line 74) | def forward(self, prev_emb, dec_state, attn_state): class BothContextGate (line 79) | class BothContextGate(nn.Module): method __init__ (line 82) | def __init__(self, embeddings_size, decoder_size, method forward (line 89) | def forward(self, prev_emb, dec_state, attn_state): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/global_attention.py class GlobalAttention (line 15) | class GlobalAttention(nn.Module): method __init__ (line 71) | def __init__(self, dim, coverage=False, attn_type="dot", method score (line 97) | def score(self, h_t, h_s): method forward (line 138) | def forward(self, source, memory_bank, memory_lengths=None, coverage=N... FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/multi_headed_attn.py class MultiHeadedAttention (line 11) | class MultiHeadedAttention(nn.Module): method __init__ (line 51) | def __init__(self, head_count, model_dim, dropout=0.1, method forward (line 77) | def forward(self, key, value, query, mask=None, method update_dropout (line 229) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/position_ffn.py class PositionwiseFeedForward (line 6) | class PositionwiseFeedForward(nn.Module): method __init__ (line 16) | def __init__(self, d_model, d_ff, dropout=0.1): method forward (line 25) | def forward(self, x): method update_dropout (line 39) | def update_dropout(self, dropout): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/sparse_activations.py function _make_ix_like (line 13) | def _make_ix_like(input, dim=0): function _threshold_and_support (line 21) | def _threshold_and_support(input, dim=0): class SparsemaxFunction (line 43) | class SparsemaxFunction(Function): method forward (line 46) | def forward(ctx, input, dim=0): method backward (line 65) | def backward(ctx, grad_output): class Sparsemax (line 80) | class Sparsemax(nn.Module): method __init__ (line 82) | def __init__(self, dim=0): method forward (line 86) | def forward(self, input): class LogSparsemax (line 90) | class LogSparsemax(nn.Module): method __init__ (line 92) | def __init__(self, dim=0): method forward (line 96) | def forward(self, input): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/sparse_losses.py class SparsemaxLossFunction (line 8) | class SparsemaxLossFunction(Function): method forward (line 11) | def forward(ctx, input, target): method backward (line 34) | def backward(ctx, grad_output): class SparsemaxLoss (line 45) | class SparsemaxLoss(nn.Module): method __init__ (line 56) | def __init__(self, weight=None, ignore_index=-100, method forward (line 64) | def forward(self, input, target): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/structured_attention.py class MatrixTree (line 6) | class MatrixTree(nn.Module): method __init__ (line 13) | def __init__(self, eps=1e-5): method forward (line 17) | def forward(self, input): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/util_class.py class Elementwise (line 7) | class Elementwise(nn.ModuleList): method __init__ (line 18) | def __init__(self, merge=None, *args): method forward (line 23) | def forward(self, inputs): class Cast (line 37) | class Cast(nn.Module): method __init__ (line 43) | def __init__(self, dtype): method forward (line 47) | def forward(self, x): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/modules/weight_norm.py function get_var_maybe_avg (line 8) | def get_var_maybe_avg(namespace, var_name, training, polyak_decay): function get_vars_maybe_avg (line 22) | def get_vars_maybe_avg(namespace, var_names, training, polyak_decay): class WeightNormLinear (line 31) | class WeightNormLinear(nn.Linear): method __init__ (line 44) | def __init__(self, in_features, out_features, method reset_parameters (line 62) | def reset_parameters(self): method forward (line 65) | def forward(self, x, init=False): class WeightNormConv2d (line 101) | class WeightNormConv2d(nn.Conv2d): method __init__ (line 102) | def __init__(self, in_channels, out_channels, kernel_size, stride=1, method reset_parameters (line 121) | def reset_parameters(self): method forward (line 124) | def forward(self, x, init=False): class WeightNormConvTranspose2d (line 174) | class WeightNormConvTranspose2d(nn.ConvTranspose2d): method __init__ (line 175) | def __init__(self, in_channels, out_channels, kernel_size, stride=1, method reset_parameters (line 196) | def reset_parameters(self): method forward (line 199) | def forward(self, x, init=False): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/opts.py function config_opts (line 8) | def config_opts(parser): function model_opts (line 16) | def model_opts(parser): function preprocess_opts (line 205) | def preprocess_opts(parser): function train_opts (line 337) | def train_opts(parser): function translate_opts (line 584) | def translate_opts(parser): class StoreLoggingLevelAction (line 758) | class StoreLoggingLevelAction(configargparse.Action): method __init__ (line 772) | def __init__(self, option_strings, dest, help=None, **kwargs): method __call__ (line 776) | def __call__(self, parser, namespace, value, option_string=None): class DeprecateAction (line 782) | class DeprecateAction(configargparse.Action): method __init__ (line 785) | def __init__(self, option_strings, dest, help=None, **kwargs): method __call__ (line 789) | def __call__(self, parser, namespace, values, flag_name): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/train_single.py function _check_save_model_path (line 18) | def _check_save_model_path(opt): function _tally_parameters (line 25) | def _tally_parameters(model): function configure_process (line 36) | def configure_process(opt, device_id): function main (line 42) | def main(opt, device_id, batch_queue=None, semaphore=None): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/trainer.py function build_trainer (line 19) | def build_trainer(opt, device_id, model, fields, optim, model_saver=None): class Trainer (line 77) | class Trainer(object): method __init__ (line 103) | def __init__(self, model, train_loss, valid_loss, optim, method _accum_count (line 146) | def _accum_count(self, step): method _maybe_update_dropout (line 152) | def _maybe_update_dropout(self, step): method _accum_batches (line 159) | def _accum_batches(self, iterator): method _update_average (line 179) | def _update_average(self, step): method train (line 193) | def train(self, method validate (line 288) | def validate(self, valid_iter, moving_average=None): method _gradient_accumulation (line 335) | def _gradient_accumulation(self, true_batches, normalization, total_st... method _start_report_manager (line 419) | def _start_report_manager(self, start_time=None): method _maybe_gather_stats (line 429) | def _maybe_gather_stats(self, stat): method _maybe_report_training (line 444) | def _maybe_report_training(self, step, num_steps, learning_rate, method _report_step (line 455) | def _report_step(self, learning_rate, step, train_stats=None, FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/beam_search.py class BeamSearch (line 9) | class BeamSearch(DecodeStrategy): method __init__ (line 58) | def __init__(self, beam_size, batch_size, pad, bos, eos, n_best, method initialize (line 96) | def initialize(self, memory_bank, src_lengths, src_map=None, device=No... method current_predictions (line 137) | def current_predictions(self): method current_backptr (line 141) | def current_backptr(self): method batch_offset (line 147) | def batch_offset(self): method advance (line 150) | def advance(self, log_probs, attn): method update_finished (line 228) | def update_finished(self): class GNMTGlobalScorer (line 312) | class GNMTGlobalScorer(object): method from_opt (line 331) | def from_opt(cls, opt): method __init__ (line 338) | def __init__(self, alpha, beta, length_penalty, coverage_penalty): method _validate (line 353) | def _validate(cls, alpha, beta, length_penalty, coverage_penalty): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/decode_strategy.py class DecodeStrategy (line 4) | class DecodeStrategy(object): method __init__ (line 56) | def __init__(self, pad, bos, eos, batch_size, parallel_paths, method initialize (line 82) | def initialize(self, memory_bank, src_lengths, src_map=None, device=No... method __len__ (line 98) | def __len__(self): method ensure_min_length (line 101) | def ensure_min_length(self, log_probs): method ensure_max_length (line 105) | def ensure_max_length(self): method block_ngram_repeats (line 111) | def block_ngram_repeats(self, log_probs): method advance (line 132) | def advance(self, log_probs, attn): method update_finished (line 141) | def update_finished(self): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/greedy_search.py function sample_with_temperature (line 6) | def sample_with_temperature(logits, sampling_temp, keep_topk): class GreedySearch (line 59) | class GreedySearch(DecodeStrategy): method __init__ (line 83) | def __init__(self, pad, bos, eos, batch_size, min_length, method initialize (line 94) | def initialize(self, memory_bank, src_lengths, src_map=None, device=No... method current_predictions (line 115) | def current_predictions(self): method batch_offset (line 119) | def batch_offset(self): method advance (line 122) | def advance(self, log_probs, attn): method update_finished (line 150) | def update_finished(self): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/penalties.py class PenaltyBuilder (line 5) | class PenaltyBuilder(object): method __init__ (line 25) | def __init__(self, cov_pen, length_pen): method _pen_is_none (line 32) | def _pen_is_none(pen): method _coverage_penalty (line 35) | def _coverage_penalty(self, cov_pen): method _length_penalty (line 46) | def _length_penalty(self, length_pen): method coverage_wu (line 61) | def coverage_wu(self, cov, beta=0.): method coverage_summary (line 74) | def coverage_summary(self, cov, beta=0.): method coverage_none (line 80) | def coverage_none(self, cov, beta=0.): method length_wu (line 88) | def length_wu(self, cur_len, alpha=0.): method length_average (line 96) | def length_average(self, cur_len, alpha=0.): method length_none (line 100) | def length_none(self, cur_len, alpha=0.): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/process_zh.py function zh_segmentator (line 7) | def zh_segmentator(line): function zh_traditional_standard (line 12) | def zh_traditional_standard(line): function zh_traditional_hk (line 17) | def zh_traditional_hk(line): function zh_traditional_tw (line 22) | def zh_traditional_tw(line): function zh_simplify (line 27) | def zh_simplify(line): function zh_simplify_v2 (line 32) | def zh_simplify_v2(line): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/translation.py class TranslationBuilder (line 9) | class TranslationBuilder(object): method __init__ (line 25) | def __init__(self, data, fields, n_best=1, replace_unk=False, method _build_target_tokens (line 36) | def _build_target_tokens(self, src, src_vocab, src_raw, pred, attn): method from_batch (line 60) | def from_batch(self, translation_batch): class Translation (line 118) | class Translation(object): method __init__ (line 137) | def __init__(self, src, src_raw, pred_sents, method log (line 148) | def log(self, sent_number): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/translation_server.py function critical (line 24) | def critical(func): class Timer (line 44) | class Timer: method __init__ (line 45) | def __init__(self, start=False): method start (line 52) | def start(self): method tick (line 57) | def tick(self, name=None, tot=False): class ServerModelError (line 70) | class ServerModelError(Exception): class TranslationServer (line 74) | class TranslationServer(object): method __init__ (line 75) | def __init__(self): method start (line 79) | def start(self, config_file): method clone_model (line 109) | def clone_model(self, model_id, opt, timeout=-1): method load_model (line 123) | def load_model(self, opt, model_id=None, **model_kwargs): method preload_model (line 131) | def preload_model(self, opt, model_id=None, **model_kwargs): method run (line 150) | def run(self, inputs): method unload_model (line 166) | def unload_model(self, model_id): method list_models (line 177) | def list_models(self): class ServerModel (line 186) | class ServerModel(object): method __init__ (line 206) | def __init__(self, opt, model_id, preprocess_opt=None, tokenizer_opt=N... method parse_opt (line 239) | def parse_opt(self, opt): method loaded (line 278) | def loaded(self): method load (line 281) | def load(self): method run (line 356) | def run(self, inputs): method do_timeout (line 473) | def do_timeout(self): method unload (line 489) | def unload(self): method stop_unload_timer (line 496) | def stop_unload_timer(self): method reset_unload_timer (line 500) | def reset_unload_timer(self): method to_dict (line 508) | def to_dict(self): method to_cpu (line 522) | def to_cpu(self): method to_gpu (line 528) | def to_gpu(self): method maybe_preprocess (line 533) | def maybe_preprocess(self, sequence): method preprocess (line 542) | def preprocess(self, sequence): method maybe_tokenize (line 557) | def maybe_tokenize(self, sequence): method tokenize (line 567) | def tokenize(self, sequence): method tokenizer_marker (line 589) | def tokenizer_marker(self): method maybe_detokenize_with_align (line 603) | def maybe_detokenize_with_align(self, sequence, src): method maybe_detokenize (line 623) | def maybe_detokenize(self, sequence): method detokenize (line 633) | def detokenize(self, sequence): method maybe_convert_align (line 649) | def maybe_convert_align(self, src, tgt, align): method maybe_postprocess (line 664) | def maybe_postprocess(self, sequence): method postprocess (line 673) | def postprocess(self, sequence): function get_function_by_path (line 689) | def get_function_by_path(path, args=[], kwargs={}): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/translate/translator.py function build_translator (line 22) | def build_translator(opt, report_score=True, logger=None, out_file=None): function max_tok_len (line 46) | def max_tok_len(new, count, sofar): class Translator (line 65) | class Translator(object): method __init__ (line 106) | def __init__( method from_opt (line 209) | def from_opt( method _log (line 272) | def _log(self, msg): method _gold_score (line 278) | def _gold_score(self, batch, memory_bank, src_lengths, src_vocabs, method translate (line 289) | def translate( method _align_pad_prediction (line 455) | def _align_pad_prediction(self, predictions, bos, pad): method _align_forward (line 482) | def _align_forward(self, batch, predictions): method translate_batch (line 528) | def translate_batch(self, batch, src_vocabs, attn_debug): method _run_encoder (line 563) | def _run_encoder(self, batch): method _decode_and_generate (line 578) | def _decode_and_generate( method _translate_batch_with_strategy (line 636) | def _translate_batch_with_strategy( method _score_target (line 727) | def _score_target(self, batch, memory_bank, src_lengths, method _report_score (line 743) | def _report_score(self, name, score_total, words_total): method _report_bleu (line 752) | def _report_bleu(self, tgt_path): method _report_rouge (line 767) | def _report_rouge(self, tgt_path): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/alignment.py function make_batch_align_matrix (line 7) | def make_batch_align_matrix(index_tensor, size=None, normalize=False): function extract_alignment (line 29) | def extract_alignment(align_matrix, tgt_mask, src_lens, n_best): function build_align_pharaoh (line 66) | def build_align_pharaoh(valid_alignment): function to_word_align (line 78) | def to_word_align(src, tgt, subword_align, mode): function subword_map_by_joiner (line 110) | def subword_map_by_joiner(subwords, marker='■'): function subword_map_by_spacer (line 126) | def subword_map_by_spacer(subwords, marker='▁'): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/cnn_factory.py function shape_transform (line 13) | def shape_transform(x): class GatedConv (line 18) | class GatedConv(nn.Module): method __init__ (line 21) | def __init__(self, input_size, width=3, dropout=0.2, nopad=False): method forward (line 29) | def forward(self, x_var): class StackedCNN (line 37) | class StackedCNN(nn.Module): method __init__ (line 40) | def __init__(self, num_layers, input_size, cnn_kernel_width=3, method forward (line 50) | def forward(self, x): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/distributed.py function is_master (line 16) | def is_master(opt, device_id): function multi_init (line 20) | def multi_init(opt, device_id): function all_reduce_and_rescale_tensors (line 35) | def all_reduce_and_rescale_tensors(tensors, rescale_denom, function all_gather_list (line 89) | def all_gather_list(data, max_size=4096): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/earlystopping.py class PatienceEnum (line 6) | class PatienceEnum(Enum): class Scorer (line 12) | class Scorer(object): method __init__ (line 13) | def __init__(self, best_score, name): method is_improving (line 17) | def is_improving(self, stats): method is_decreasing (line 20) | def is_decreasing(self, stats): method update (line 23) | def update(self, stats): method __call__ (line 26) | def __call__(self, stats, **kwargs): method _caller (line 29) | def _caller(self, stats): class PPLScorer (line 33) | class PPLScorer(Scorer): method __init__ (line 35) | def __init__(self): method is_improving (line 38) | def is_improving(self, stats): method is_decreasing (line 41) | def is_decreasing(self, stats): method _caller (line 44) | def _caller(self, stats): class AccuracyScorer (line 48) | class AccuracyScorer(Scorer): method __init__ (line 50) | def __init__(self): method is_improving (line 53) | def is_improving(self, stats): method is_decreasing (line 56) | def is_decreasing(self, stats): method _caller (line 59) | def _caller(self, stats): function scorers_from_opts (line 72) | def scorers_from_opts(opt): class EarlyStopping (line 84) | class EarlyStopping(object): method __init__ (line 86) | def __init__(self, tolerance, scorers=DEFAULT_SCORERS): method __call__ (line 102) | def __call__(self, valid_stats, step): method _update_stalled (line 133) | def _update_stalled(self): method _update_increasing (line 148) | def _update_increasing(self, valid_stats, step): method _update_decreasing (line 165) | def _update_decreasing(self): method _log_best_step (line 181) | def _log_best_step(self): method _decreasing_or_stopped_status_update (line 185) | def _decreasing_or_stopped_status_update(self, tolerance): method is_improving (line 190) | def is_improving(self): method has_stopped (line 193) | def has_stopped(self): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/logging.py function init_logger (line 9) | def init_logger(log_file=None, log_file_level=logging.NOTSET): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/loss.py function build_loss_compute (line 15) | def build_loss_compute(model, tgt_field, opt, train=True): class LossComputeBase (line 67) | class LossComputeBase(nn.Module): method __init__ (line 86) | def __init__(self, criterion, generator): method padding_idx (line 92) | def padding_idx(self): method _make_shard_state (line 95) | def _make_shard_state(self, batch, output, range_, attns=None): method _compute_loss (line 109) | def _compute_loss(self, batch, output, target, **kwargs): method __call__ (line 122) | def __call__(self, method _stats (line 171) | def _stats(self, loss, scores, target): method _bottle (line 187) | def _bottle(self, _v): method _unbottle (line 190) | def _unbottle(self, _v, batch_size): class LabelSmoothingLoss (line 194) | class LabelSmoothingLoss(nn.Module): method __init__ (line 200) | def __init__(self, label_smoothing, tgt_vocab_size, ignore_index=-100): method forward (line 212) | def forward(self, output, target): class NMTLossCompute (line 224) | class NMTLossCompute(LossComputeBase): method __init__ (line 229) | def __init__(self, criterion, generator, normalization="sents", method _make_shard_state (line 235) | def _make_shard_state(self, batch, output, range_, attns=None): method _compute_loss (line 278) | def _compute_loss(self, batch, output, target, std_attn=None, method _compute_coverage_loss (line 303) | def _compute_coverage_loss(self, std_attn, coverage_attn): method _compute_alignement_loss (line 308) | def _compute_alignement_loss(self, align_head, ref_align): function filter_shard_state (line 319) | def filter_shard_state(state, shard_size=None): function shards (line 334) | def shards(state, shard_size, eval_only=False): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/misc.py function split_corpus (line 10) | def split_corpus(path, shard_size, default=None): function _split_corpus (line 20) | def _split_corpus(path, shard_size): function aeq (line 34) | def aeq(*args): function sequence_mask (line 44) | def sequence_mask(lengths, max_len=None): function tile (line 56) | def tile(x, count, dim=0): function use_gpu (line 78) | def use_gpu(opt): function set_random_seed (line 86) | def set_random_seed(seed, is_cuda): function generate_relative_positions_matrix (line 102) | def generate_relative_positions_matrix(length, max_relative_positions, function relative_matmul (line 120) | def relative_matmul(x, z, transpose): function fn_args (line 137) | def fn_args(fun): function report_matrix (line 142) | def report_matrix(row_label, column_label, matrix): function check_model_config (line 157) | def check_model_config(model_config, root): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/optimizers.py function build_torch_optimizer (line 14) | def build_torch_optimizer(model, opt): function make_learning_rate_decay_fn (line 111) | def make_learning_rate_decay_fn(opt): function noam_decay (line 137) | def noam_decay(step, warmup_steps, model_size): function noamwd_decay (line 146) | def noamwd_decay(step, warmup_steps, function exponential_decay (line 156) | def exponential_decay(step, rate, decay_steps, start_step=0): function rsqrt_decay (line 163) | def rsqrt_decay(step, warmup_steps): class MultipleOptimizer (line 168) | class MultipleOptimizer(object): method __init__ (line 171) | def __init__(self, op): method param_groups (line 176) | def param_groups(self): method zero_grad (line 182) | def zero_grad(self): method step (line 187) | def step(self): method state (line 193) | def state(self): method state_dict (line 197) | def state_dict(self): method load_state_dict (line 201) | def load_state_dict(self, state_dicts): class Optimizer (line 208) | class Optimizer(object): method __init__ (line 217) | def __init__(self, method from_opt (line 240) | def from_opt(cls, model, opt, checkpoint=None): method training_step (line 297) | def training_step(self): method learning_rate (line 301) | def learning_rate(self): method state_dict (line 308) | def state_dict(self): method load_state_dict (line 315) | def load_state_dict(self, state_dict): method zero_grad (line 323) | def zero_grad(self): method backward (line 327) | def backward(self, loss): method step (line 342) | def step(self): class AdaFactor (line 368) | class AdaFactor(torch.optim.Optimizer): method __init__ (line 370) | def __init__(self, params, lr=None, beta1=0.9, beta2=0.999, eps1=1e-30, method __setstate__ (line 388) | def __setstate__(self, state): method _experimental_reshape (line 391) | def _experimental_reshape(self, shape): method _check_shape (line 403) | def _check_shape(self, shape): method _rms (line 417) | def _rms(self, x): method step (line 420) | def step(self, closure=None): class FusedAdam (line 538) | class FusedAdam(torch.optim.Optimizer): method __init__ (line 567) | def __init__(self, params, method step (line 582) | def step(self, closure=None, grads=None, output_params=None, FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/parse.py class ArgumentParser (line 10) | class ArgumentParser(cfargparse.ArgumentParser): method __init__ (line 11) | def __init__( method defaults (line 22) | def defaults(cls, *args): method update_model_opts (line 31) | def update_model_opts(cls, model_opt): method validate_model_opts (line 55) | def validate_model_opts(cls, model_opt): method ckpt_model_opts (line 84) | def ckpt_model_opts(cls, ckpt_opt): method validate_train_opts (line 93) | def validate_train_opts(cls, opt): method validate_translate_opts (line 124) | def validate_translate_opts(cls, opt): method validate_preprocess_args (line 129) | def validate_preprocess_args(cls, opt): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/report_manager.py function build_report_manager (line 11) | def build_report_manager(opt, gpu_rank): class ReportMgrBase (line 28) | class ReportMgrBase(object): method __init__ (line 36) | def __init__(self, report_every, start_time=-1.): method start (line 46) | def start(self): method log (line 49) | def log(self, *args, **kwargs): method report_training (line 52) | def report_training(self, step, num_steps, learning_rate, method _report_training (line 80) | def _report_training(self, *args, **kwargs): method report_step (line 84) | def report_step(self, lr, step, train_stats=None, valid_stats=None): method _report_step (line 96) | def _report_step(self, *args, **kwargs): class ReportMgr (line 100) | class ReportMgr(ReportMgrBase): method __init__ (line 101) | def __init__(self, report_every, start_time=-1., tensorboard_writer=No... method maybe_log_tensorboard (line 114) | def maybe_log_tensorboard(self, stats, prefix, learning_rate, step): method _report_training (line 119) | def _report_training(self, step, num_steps, learning_rate, method _report_step (line 135) | def _report_step(self, lr, step, train_stats=None, valid_stats=None): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/rnn_factory.py function rnn_factory (line 8) | def rnn_factory(rnn_type, **kwargs): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/onmt/utils/statistics.py class Statistics (line 10) | class Statistics(object): method __init__ (line 20) | def __init__(self, loss=0, n_words=0, n_correct=0): method all_gather_stats (line 28) | def all_gather_stats(stat, max_size=4096): method all_gather_stats_list (line 44) | def all_gather_stats_list(stat_list, max_size=4096): method update (line 71) | def update(self, stat, update_n_src_words=False): method accuracy (line 88) | def accuracy(self): method xent (line 92) | def xent(self): method ppl (line 96) | def ppl(self): method elapsed_time (line 100) | def elapsed_time(self): method output (line 104) | def output(self, step, num_steps, learning_rate, start): method log_tensorboard (line 129) | def log_tensorboard(self, prefix, writer, learning_rate, step): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/apply_bpe.py class BPE (line 31) | class BPE(object): method __init__ (line 33) | def __init__(self, codes, separator='@@', vocab=None, glossaries=None): method segment (line 61) | def segment(self, sentence): method _isolate_glossaries (line 81) | def _isolate_glossaries(self, word): function create_parser (line 89) | def create_parser(): function get_pairs (line 126) | def get_pairs(word): function encode (line 139) | def encode(orig, bpe_codes, bpe_codes_reverse, vocab, separator, version... function recursive_split (line 204) | def recursive_split(segment, bpe_codes, vocab, separator, final=False): function check_vocab_and_split (line 232) | def check_vocab_and_split(orig, bpe_codes, vocab, separator): function read_vocabulary (line 257) | def read_vocabulary(vocab_file, threshold): function isolate_glossary (line 272) | def isolate_glossary(word, glossary): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/create_vocabulary.py function read_files_batch (line 8) | def read_files_batch(file_list): function main (line 38) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/embeddings_to_torch.py function get_vocabs (line 11) | def get_vocabs(dict_path): function read_embeddings (line 33) | def read_embeddings(file_enc, skip_lines=0, filter_set=None): function convert_to_torch_tensor (line 56) | def convert_to_torch_tensor(word_to_float_list_dict, vocab): function calc_vocab_load_stats (line 64) | def calc_vocab_load_stats(vocab, loaded_embed_dict): function main (line 72) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/extract_embeddings.py function write_embeddings (line 23) | def write_embeddings(filename, dict, embeddings): function main (line 32) | def main(): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/learn_bpe.py function create_parser (line 30) | def create_parser(): function get_vocabulary (line 59) | def get_vocabulary(fobj, is_dict=False): function update_pair_statistics (line 73) | def update_pair_statistics(pair, changed, stats, indices): function get_pair_statistics (line 132) | def get_pair_statistics(vocab): function replace_pair (line 151) | def replace_pair(pair, vocab, indices): function prune_stats (line 177) | def prune_stats(stats, big_stats, threshold): function main (line 193) | def main(infile, outfile, num_symbols, min_frequency=2, verbose=False, i... FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/test_rouge.py function test_rouge (line 13) | def test_rouge(cand, ref): function rouge_results_to_str (line 51) | def rouge_results_to_str(results_dict): FILE: 深度学习自然语言处理/机器翻译/OpenNMT-py/tools/vid_feature_extractor.py function read_to_imgs (line 18) | def read_to_imgs(file): function vid_len (line 30) | def vid_len(path): class VidDset (line 35) | class VidDset(object): method __init__ (line 37) | def __init__(self, model, root_dir, filenames): method __len__ (line 45) | def __len__(self): method __getitem__ (line 48) | def __getitem__(self, i): method __iter__ (line 53) | def __iter__(self): method next (line 56) | def next(self): method __next__ (line 63) | def __next__(self): function collate_tensor (line 67) | def collate_tensor(batch): function batch (line 71) | def batch(dset, batch_size): class FeatureExtractor (line 91) | class FeatureExtractor(nn.Module): method __init__ (line 93) | def __init__(self): method forward (line 98) | def forward(self, x): class Reconstructor (line 103) | class Reconstructor(object): method __init__ (line 110) | def __init__(self, out_path, finished_queue): method save (line 115) | def save(self, path, feats): method name_ (line 119) | def name_(path, out_path): method name (line 128) | def name(self, path): method push (line 131) | def push(self, paths, idxs, feats): method flush (line 161) | def flush(self): function finished_watcher (line 168) | def finished_watcher(finished_queue, world_size, root_dir, files): function run (line 187) | def run(device_id, world_size, root_dir, batch_size_per_device, function saver (line 216) | def saver(out_path, feats_queue, finished_queue):