SYMBOL INDEX (758 symbols across 73 files) FILE: 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: onmt/decoders/decoder.py class DecoderBase (line 13) | class DecoderBase(nn.Module): method __init__ (line 20) | def __init__(self, attentional=True): method from_opt (line 25) | def from_opt(cls, opt, embeddings): class RNNDecoderBase (line 34) | class RNNDecoderBase(DecoderBase): method __init__ (line 85) | def __init__(self, rnn_type, bidirectional_encoder, num_layers, method from_opt (line 158) | def from_opt(cls, opt, embeddings): method init_state (line 176) | def init_state(self, src, memory_bank, encoder_final): method map_state (line 201) | def map_state(self, fn): method detach_state (line 207) | def detach_state(self): method forward (line 211) | def forward(self, tgt, memory_bank, memory_lengths=None, step=None, co... method update_dropout (line 255) | def update_dropout(self, dropout): class StdRNNDecoder (line 260) | class StdRNNDecoder(RNNDecoderBase): method _run_forward_pass (line 276) | def _run_forward_pass(self, tgt, memory_bank, memory_lengths=None, cop... method _build_rnn (line 339) | def _build_rnn(self, rnn_type, **kwargs): method _input_size (line 344) | def _input_size(self): class InputFeedRNNDecoder (line 348) | class InputFeedRNNDecoder(RNNDecoderBase): method _run_forward_pass (line 376) | def _run_forward_pass(self, tgt, memory_bank, memory_lengths=None, cop... method _build_rnn (line 468) | def _build_rnn(self, rnn_type, input_size, method _input_size (line 476) | def _input_size(self): method update_dropout (line 480) | def update_dropout(self, dropout): FILE: 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 68) | def combine_attns(self, attns): method init_state (line 75) | def init_state(self, src, memory_bank, enc_hidden): method map_state (line 80) | def map_state(self, fn): class EnsembleGenerator (line 85) | class EnsembleGenerator(nn.Module): method __init__ (line 90) | def __init__(self, model_generators, raw_probs=False): method forward (line 95) | def forward(self, hidden, attn=None, src_map=None): class EnsembleModel (line 111) | class EnsembleModel(NMTModel): method __init__ (line 113) | def __init__(self, models, raw_probs=False): function load_test_model (line 122) | def load_test_model(opt): FILE: 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, method forward (line 46) | def forward(self, inputs, memory_bank, src_pad_mask, tgt_pad_mask, method update_dropout (line 94) | def update_dropout(self, dropout): class TransformerDecoder (line 101) | class TransformerDecoder(DecoderBase): method __init__ (line 131) | def __init__(self, num_layers, d_model, heads, d_ff, method from_opt (line 155) | def from_opt(cls, opt, embeddings): method init_state (line 169) | def init_state(self, src, memory_bank, enc_hidden): method map_state (line 174) | def map_state(self, fn): method detach_state (line 187) | def detach_state(self): method forward (line 190) | def forward(self, tgt, memory_bank, step=None, **kwargs): method _init_cache (line 231) | def _init_cache(self, memory_bank): method update_dropout (line 246) | def update_dropout(self, dropout): FILE: 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: 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: 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: 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: 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: 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 60) | def from_opt(cls, opt, embeddings): method forward (line 71) | def forward(self, src, lengths=None): method _initialize_bridge (line 102) | def _initialize_bridge(self, rnn_type, method _bridge (line 117) | def _bridge(self, hidden): method update_dropout (line 134) | def update_dropout(self, dropout): FILE: 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, method forward (line 37) | def forward(self, inputs, mask): method update_dropout (line 54) | def update_dropout(self, dropout): class TransformerEncoder (line 60) | class TransformerEncoder(EncoderBase): method __init__ (line 91) | def __init__(self, num_layers, d_model, heads, d_ff, dropout, embeddings, method from_opt (line 104) | def from_opt(cls, opt, embeddings): method forward (line 115) | def forward(self, src, lengths=None): method update_dropout (line 130) | def update_dropout(self, dropout): FILE: 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: 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: 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): FILE: 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: 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): function get_fields (line 61) | def get_fields( function load_old_vocab (line 142) | def load_old_vocab(vocab, data_type="text", dynamic_dict=False): function _old_style_vocab (line 194) | def _old_style_vocab(vocab): function _old_style_nesting (line 213) | def _old_style_nesting(vocab): function _old_style_field_list (line 219) | def _old_style_field_list(vocab): function old_style_vocab (line 238) | def old_style_vocab(vocab): function filter_example (line 244) | def filter_example(ex, use_src_len=True, use_tgt_len=True, function _pad_vocab_to_multiple (line 272) | def _pad_vocab_to_multiple(vocab, multiple): function _build_field_vocab (line 283) | def _build_field_vocab(field, counter, size_multiple=1, **kwargs): function _load_vocab (line 294) | def _load_vocab(vocab_path, name, counters, min_freq): function _build_fv_from_multifield (line 306) | def _build_fv_from_multifield(multifield, counters, build_fv_args, function _build_fields_vocab (line 317) | def _build_fields_vocab(fields, counters, data_type, share_vocab, function build_vocab (line 353) | def build_vocab(train_dataset_files, fields, data_type, share_vocab, function _merge_field_vocabs (line 446) | def _merge_field_vocabs(src_field, tgt_field, vocab_size, min_freq, function _read_vocab_file (line 466) | def _read_vocab_file(vocab_path, tag): function batch_iter (line 487) | def batch_iter(data, batch_size, batch_size_fn=None, batch_size_multiple... function _pool (line 520) | def _pool(data, batch_size, batch_size_fn, batch_size_multiple, class OrderedIterator (line 534) | class OrderedIterator(torchtext.data.Iterator): method __init__ (line 536) | def __init__(self, method create_batches (line 549) | def create_batches(self): method __iter__ (line 575) | def __iter__(self): class MultipleDatasetIterator (line 608) | class MultipleDatasetIterator(object): method __init__ (line 613) | def __init__(self, method _iter_datasets (line 637) | def _iter_datasets(self): method _iter_examples (line 646) | def _iter_examples(self): method __iter__ (line 650) | def __iter__(self): class DatasetLazyIter (line 666) | class DatasetLazyIter(object): method __init__ (line 679) | def __init__(self, dataset_paths, fields, batch_size, batch_size_fn, method _iter_dataset (line 694) | def _iter_dataset(self, path): method __iter__ (line 723) | def __iter__(self): function max_tok_len (line 747) | def max_tok_len(new, count, sofar): function build_dataset_iter (line 768) | def build_dataset_iter(corpus_type, fields, opt, is_train=True, multi=Fa... function build_dataset_iter_multiple (line 807) | def build_dataset_iter_multiple(train_shards, fields, opt): FILE: 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: 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: 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 266) | def build_model(model_opt, opt, fields, checkpoint): FILE: onmt/models/model.py class NMTModel (line 10) | class NMTModel(nn.Module): method __init__ (line 20) | def __init__(self, encoder, decoder): method forward (line 25) | def forward(self, src, tgt, lengths, bptt=False): method update_dropout (line 55) | def update_dropout(self, dropout): class SNILayer (line 59) | class SNILayer(nn.Module): method __init__ (line 60) | def __init__(self, opt): method forward (line 67) | def forward(self, memory_bank, lengths): class SNIModel (line 81) | class SNIModel(nn.Module): method __init__ (line 82) | def __init__(self, encoder, decoder, opt): method forward (line 89) | def forward(self, src, tgt, lengths, bptt=False): FILE: onmt/models/model_saver.py function build_model_saver (line 11) | def build_model_saver(model_opt, opt, model, fields, optim): class ModelSaverBase (line 21) | class ModelSaverBase(object): method __init__ (line 29) | def __init__(self, base_path, model, model_opt, fields, optim, method save (line 41) | def save(self, step, moving_average=None): method _save (line 70) | def _save(self, step): method _rm_checkpoint (line 85) | def _rm_checkpoint(self, name): class ModelSaver (line 96) | class ModelSaver(ModelSaverBase): method _save (line 99) | def _save(self, step, model): method _rm_checkpoint (line 140) | def _rm_checkpoint(self, name): FILE: 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: 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: 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: 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: 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: 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: 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: 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 99) | def score(self, h_t, h_s): method forward (line 140) | def forward(self, source, memory_bank, memory_lengths=None, coverage=N... class SelfAttention (line 238) | class SelfAttention(nn.Module): method __init__ (line 244) | def __init__(self, input_size): method forward (line 248) | def forward(self, x, lengths): FILE: 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 230) | def update_dropout(self, dropout): FILE: 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: 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: 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: 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: onmt/modules/util_class.py class Elementwise (line 8) | class Elementwise(nn.ModuleList): method __init__ (line 19) | def __init__(self, merge=None, source_num=1, *args): method forward (line 27) | def forward(self, inputs): class Cast (line 48) | class Cast(nn.Module): method __init__ (line 54) | def __init__(self, dtype): method forward (line 58) | def forward(self, x): FILE: 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: 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 196) | def preprocess_opts(parser): function train_opts (line 320) | def train_opts(parser): function translate_opts (line 565) | def translate_opts(parser): class StoreLoggingLevelAction (line 731) | class StoreLoggingLevelAction(configargparse.Action): method __init__ (line 745) | def __init__(self, option_strings, dest, help=None, **kwargs): method __call__ (line 749) | def __call__(self, parser, namespace, value, option_string=None): class DeprecateAction (line 755) | class DeprecateAction(configargparse.Action): method __init__ (line 758) | def __init__(self, option_strings, dest, help=None, **kwargs): method __call__ (line 762) | def __call__(self, parser, namespace, values, flag_name): FILE: onmt/tests/test_attention.py class TestAttention (line 11) | class TestAttention(unittest.TestCase): method test_masked_global_attention (line 13) | def test_masked_global_attention(self): FILE: onmt/tests/test_audio_dataset.py class TestAudioField (line 15) | class TestAudioField(unittest.TestCase): method degenerate_case (line 28) | def degenerate_case(cls, init_case, params): method pad_inputs (line 34) | def pad_inputs(cls, params): method numericalize_inputs (line 44) | def numericalize_inputs(cls, init_case, params): method test_pad_shape_and_lengths (line 59) | def test_pad_shape_and_lengths(self): method test_pad_returns_correct_lengths (line 73) | def test_pad_returns_correct_lengths(self): method test_pad_pads_right_places_and_uses_correct_index (line 83) | def test_pad_pads_right_places_and_uses_correct_index(self): method test_numericalize_shape (line 98) | def test_numericalize_shape(self): method test_process_shape (line 119) | def test_process_shape(self): method test_process_lengths (line 140) | def test_process_lengths(self): class TestAudioDataReader (line 153) | class TestAudioDataReader(unittest.TestCase): method setUpClass (line 181) | def setUpClass(cls): method tearDownClass (line 203) | def tearDownClass(cls): method test_read_from_dir_and_data_file_containing_filenames (line 207) | def test_read_from_dir_and_data_file_containing_filenames(self): method test_read_from_dir_and_data_file_containing_paths (line 218) | def test_read_from_dir_and_data_file_containing_paths(self): FILE: onmt/tests/test_beam.py class GlobalScorerStub (line 7) | class GlobalScorerStub(object): method update_global_state (line 8) | def update_global_state(self, beam): method score (line 11) | def score(self, beam, scores): class TestBeam (line 15) | class TestBeam(unittest.TestCase): method test_advance_with_all_repeats_gets_blocked (line 18) | def test_advance_with_all_repeats_gets_blocked(self): method test_advance_with_some_repeats_gets_blocked (line 44) | def test_advance_with_some_repeats_gets_blocked(self): method test_repeating_excluded_index_does_not_die (line 80) | def test_repeating_excluded_index_does_not_die(self): method test_doesnt_predict_eos_if_shorter_than_min_len (line 125) | def test_doesnt_predict_eos_if_shorter_than_min_len(self): method test_beam_is_done_when_n_best_beams_eos_using_min_length (line 177) | def test_beam_is_done_when_n_best_beams_eos_using_min_length(self): class TestBeamAgainstReferenceCase (line 235) | class TestBeamAgainstReferenceCase(unittest.TestCase): method init_step (line 243) | def init_step(self, beam): method first_step (line 255) | def first_step(self, beam, expected_beam_scores, expected_len_pen): method second_step (line 287) | def second_step(self, beam, expected_beam_scores, expected_len_pen): method third_step (line 322) | def third_step(self, beam, expected_beam_scores, expected_len_pen): method test_beam_advance_against_known_reference (line 356) | def test_beam_advance_against_known_reference(self): class TestBeamWithLengthPenalty (line 369) | class TestBeamWithLengthPenalty(TestBeamAgainstReferenceCase): method test_beam_advance_against_known_reference (line 373) | def test_beam_advance_against_known_reference(self): FILE: onmt/tests/test_beam_search.py class GlobalScorerStub (line 10) | class GlobalScorerStub(object): method __init__ (line 14) | def __init__(self): method update_global_state (line 21) | def update_global_state(self, beam): method score (line 24) | def score(self, beam, scores): class TestBeamSearch (line 28) | class TestBeamSearch(unittest.TestCase): method test_advance_with_all_repeats_gets_blocked (line 31) | def test_advance_with_all_repeats_gets_blocked(self): method test_advance_with_some_repeats_gets_blocked (line 61) | def test_advance_with_some_repeats_gets_blocked(self): method test_repeating_excluded_index_does_not_die (line 107) | def test_repeating_excluded_index_does_not_die(self): method test_doesnt_predict_eos_if_shorter_than_min_len (line 161) | def test_doesnt_predict_eos_if_shorter_than_min_len(self): method test_beam_is_done_when_n_best_beams_eos_using_min_length (line 216) | def test_beam_is_done_when_n_best_beams_eos_using_min_length(self): method test_beam_returns_attn_with_correct_length (line 275) | def test_beam_returns_attn_with_correct_length(self): class TestBeamSearchAgainstReferenceCase (line 355) | class TestBeamSearchAgainstReferenceCase(unittest.TestCase): method random_attn (line 366) | def random_attn(self): method init_step (line 369) | def init_step(self, beam, expected_len_pen): method first_step (line 386) | def first_step(self, beam, expected_beam_scores, expected_len_pen): method second_step (line 419) | def second_step(self, beam, expected_beam_scores, expected_len_pen): method third_step (line 458) | def third_step(self, beam, expected_beam_scores, expected_len_pen): method test_beam_advance_against_known_reference (line 495) | def test_beam_advance_against_known_reference(self): class TestBeamWithLengthPenalty (line 508) | class TestBeamWithLengthPenalty(TestBeamSearchAgainstReferenceCase): method test_beam_advance_against_known_reference (line 512) | def test_beam_advance_against_known_reference(self): FILE: onmt/tests/test_copy_generator.py class TestCopyGenerator (line 13) | class TestCopyGenerator(unittest.TestCase): method dummy_inputs (line 27) | def dummy_inputs(cls, params, init_case): method expected_shape (line 37) | def expected_shape(cls, params, init_case): method test_copy_gen_forward_shape (line 41) | def test_copy_gen_forward_shape(self): method test_copy_gen_outp_has_no_prob_of_pad (line 50) | def test_copy_gen_outp_has_no_prob_of_pad(self): method test_copy_gen_trainable_params_update (line 59) | def test_copy_gen_trainable_params_update(self): class TestCopyGeneratorLoss (line 80) | class TestCopyGeneratorLoss(unittest.TestCase): method dummy_inputs (line 94) | def dummy_inputs(cls, params, init_case): method expected_shape (line 108) | def expected_shape(cls, params, init_case): method test_copy_loss_forward_shape (line 111) | def test_copy_loss_forward_shape(self): method test_copy_loss_ignore_index_is_ignored (line 120) | def test_copy_loss_ignore_index_is_ignored(self): method test_copy_loss_output_range_is_positive (line 130) | def test_copy_loss_output_range_is_positive(self): FILE: onmt/tests/test_embeddings.py class TestEmbeddings (line 12) | class TestEmbeddings(unittest.TestCase): method case_is_degenerate (line 32) | def case_is_degenerate(cls, case): method cases (line 56) | def cases(cls): method dummy_inputs (line 62) | def dummy_inputs(cls, params, init_case): method expected_shape (line 81) | def expected_shape(cls, params, init_case): method test_embeddings_forward_shape (line 90) | def test_embeddings_forward_shape(self): method test_embeddings_trainable_params (line 98) | def test_embeddings_trainable_params(self): method test_embeddings_trainable_params_update (line 131) | def test_embeddings_trainable_params_update(self): FILE: onmt/tests/test_image_dataset.py class TestImageDataReader (line 12) | class TestImageDataReader(unittest.TestCase): method setUpClass (line 39) | def setUpClass(cls): method tearDownClass (line 62) | def tearDownClass(cls): method test_read_from_dir_and_data_file_containing_filenames (line 66) | def test_read_from_dir_and_data_file_containing_filenames(self): method test_read_from_dir_and_data_file_containing_paths (line 78) | def test_read_from_dir_and_data_file_containing_paths(self): class TestImageDataReader1Channel (line 91) | class TestImageDataReader1Channel(TestImageDataReader): FILE: onmt/tests/test_models.py class TestModel (line 24) | class TestModel(unittest.TestCase): method __init__ (line 26) | def __init__(self, *args, **kwargs): method get_field (line 30) | def get_field(self): method get_batch (line 35) | def get_batch(self, source_l=3, bsize=1): method get_batch_image (line 42) | def get_batch_image(self, tgt_l=3, bsize=1, h=15, w=17): method get_batch_audio (line 49) | def get_batch_audio(self, tgt_l=7, bsize=3, sample_rate=5500, method embeddings_forward (line 58) | def embeddings_forward(self, opt, source_l=3, bsize=1): method encoder_forward (line 81) | def encoder_forward(self, opt, source_l=3, bsize=1): method nmtmodel_forward (line 112) | def nmtmodel_forward(self, opt, source_l=3, bsize=1): method imagemodel_forward (line 143) | def imagemodel_forward(self, opt, tgt_l=2, bsize=1, h=15, w=17): method audiomodel_forward (line 176) | def audiomodel_forward(self, opt, tgt_l=7, bsize=3, t=37): function _add_test (line 215) | def _add_test(param_setting, methodname): FILE: onmt/tests/test_preprocess.py class TestData (line 35) | class TestData(unittest.TestCase): method __init__ (line 36) | def __init__(self, *args, **kwargs): method dataset_build (line 40) | def dataset_build(self, opt): function _add_test (line 67) | def _add_test(param_setting, methodname): FILE: onmt/tests/test_random_sampling.py class TestRandomSampling (line 7) | class TestRandomSampling(unittest.TestCase): method test_advance_with_repeats_gets_blocked (line 14) | def test_advance_with_repeats_gets_blocked(self): method test_advance_with_some_repeats_gets_blocked (line 38) | def test_advance_with_some_repeats_gets_blocked(self): method test_repeating_excluded_index_does_not_die (line 79) | def test_repeating_excluded_index_does_not_die(self): method test_doesnt_predict_eos_if_shorter_than_min_len (line 112) | def test_doesnt_predict_eos_if_shorter_than_min_len(self): method test_returns_correct_scores_deterministic (line 152) | def test_returns_correct_scores_deterministic(self): method test_returns_correct_scores_non_deterministic (line 224) | def test_returns_correct_scores_non_deterministic(self): FILE: onmt/tests/test_simple.py function test_load (line 4) | def test_load(): FILE: onmt/tests/test_structured_attention.py class TestStructuredAttention (line 7) | class TestStructuredAttention(unittest.TestCase): method test_matrix_tree_marg_pdfs_sum_to_1 (line 8) | def test_matrix_tree_marg_pdfs_sum_to_1(self): FILE: onmt/tests/test_text_dataset.py class TestTextMultiField (line 13) | class TestTextMultiField(unittest.TestCase): method initialize_case (line 26) | def initialize_case(cls, init_case, params): method test_process_shape (line 36) | def test_process_shape(self): method test_preprocess_shape (line 77) | def test_preprocess_shape(self): method test_base_field (line 86) | def test_base_field(self): method test_correct_n_fields (line 93) | def test_correct_n_fields(self): method test_fields_order_correct (line 101) | def test_fields_order_correct(self): method test_getitem_0_returns_correct_field (line 110) | def test_getitem_0_returns_correct_field(self): method test_getitem_nonzero_returns_correct_field (line 118) | def test_getitem_nonzero_returns_correct_field(self): method test_getitem_has_correct_number_of_indexes (line 131) | def test_getitem_has_correct_number_of_indexes(self): class TestTextDataReader (line 141) | class TestTextDataReader(unittest.TestCase): method test_read (line 142) | def test_read(self): class TestTextDataReaderFromFS (line 153) | class TestTextDataReaderFromFS(unittest.TestCase): method setUpClass (line 164) | def setUpClass(cls): method tearDownClass (line 171) | def tearDownClass(cls): method test_read (line 174) | def test_read(self): FILE: onmt/tests/test_translation_server.py class TestServerModel (line 16) | class TestServerModel(unittest.TestCase): method test_deferred_loading_model_and_unload (line 17) | def test_deferred_loading_model_and_unload(self): method test_load_model_on_init_and_unload (line 29) | def test_load_model_on_init_and_unload(self): method test_tokenizing_with_no_tokenizer_fails (line 39) | def test_tokenizing_with_no_tokenizer_fails(self): method test_detokenizing_with_no_tokenizer_fails (line 47) | def test_detokenizing_with_no_tokenizer_fails(self): method test_moving_to_gpu_and_back (line 56) | def test_moving_to_gpu_and_back(self): method test_initialize_on_gpu_and_move_back (line 72) | def test_initialize_on_gpu_and_move_back(self): method test_initialize_on_nonzero_gpu_and_back (line 90) | def test_initialize_on_nonzero_gpu_and_back(self): method test_run (line 108) | def test_run(self): method test_nbest_init_fails (line 129) | def test_nbest_init_fails(self): class TestTranslationServer (line 137) | class TestTranslationServer(unittest.TestCase): method tearDown (line 144) | def tearDown(self): method write (line 148) | def write(self, cfg): method test_start_without_initial_loading (line 170) | def test_start_without_initial_loading(self): method test_start_with_initial_loading (line 195) | def test_start_with_initial_loading(self): method test_start_with_two_models (line 230) | def test_start_with_two_models(self): FILE: onmt/tests/utils_for_tests.py function product_dict (line 4) | def product_dict(**kwargs): FILE: 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: onmt/trainer.py function build_trainer (line 22) | def build_trainer(opt, device_id, model, fields, optim, model_saver=None): class Trainer (line 81) | class Trainer(object): method __init__ (line 107) | def __init__(self, model, train_loss, valid_loss, optim, method _accum_count (line 151) | def _accum_count(self, step): method _maybe_update_dropout (line 157) | def _maybe_update_dropout(self, step): method _accum_batches (line 164) | def _accum_batches(self, iterator): method _update_average (line 184) | def _update_average(self, step): method train (line 198) | def train(self, method validate (line 296) | def validate(self, valid_iter, moving_average=None): method _get_src_label (line 338) | def _get_src_label(self, src, tgt): method _gradient_accumulation (line 357) | def _gradient_accumulation(self, true_batches, normalization, total_st... method _start_report_manager (line 458) | def _start_report_manager(self, start_time=None): method _maybe_gather_stats (line 468) | def _maybe_gather_stats(self, stat): method _maybe_report_training (line 483) | def _maybe_report_training(self, step, num_steps, learning_rate, method _report_step (line 494) | def _report_step(self, learning_rate, step, train_stats=None, FILE: onmt/translate/beam.py class Beam (line 8) | class Beam(object): method __init__ (line 31) | def __init__(self, size, pad, bos, eos, method current_predictions (line 78) | def current_predictions(self): method current_origin (line 82) | def current_origin(self): method advance (line 86) | def advance(self, word_probs, attn_out): method done (line 168) | def done(self): method sort_finished (line 171) | def sort_finished(self, minimum=None): method get_hyp (line 186) | def get_hyp(self, timestep, k): class GNMTGlobalScorer (line 196) | class GNMTGlobalScorer(object): method from_opt (line 215) | def from_opt(cls, opt): method __init__ (line 222) | def __init__(self, alpha, beta, length_penalty, coverage_penalty): method _validate (line 237) | def _validate(cls, alpha, beta, length_penalty, coverage_penalty): method score (line 260) | def score(self, beam, logprobs): method update_score (line 271) | def update_score(self, beam, attn): method update_global_state (line 279) | def update_global_state(self, beam): FILE: onmt/translate/beam_search.py class BeamSearch (line 6) | class BeamSearch(DecodeStrategy): method __init__ (line 56) | def __init__(self, beam_size, batch_size, pad, bos, eos, n_best, mb_de... method current_predictions (line 108) | def current_predictions(self): method current_origin (line 112) | def current_origin(self): method current_backptr (line 116) | def current_backptr(self): method advance (line 121) | def advance(self, log_probs, attn): method update_finished (line 200) | def update_finished(self): FILE: onmt/translate/decode_strategy.py class DecodeStrategy (line 4) | class DecodeStrategy(object): method __init__ (line 57) | def __init__(self, pad, bos, eos, batch_size, device, parallel_paths, method __len__ (line 87) | def __len__(self): method ensure_min_length (line 90) | def ensure_min_length(self, log_probs): method ensure_max_length (line 94) | def ensure_max_length(self): method block_ngram_repeats (line 100) | def block_ngram_repeats(self, log_probs): method advance (line 121) | def advance(self, log_probs, attn): method update_finished (line 130) | def update_finished(self): FILE: 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: onmt/translate/random_sampling.py function sample_with_temperature (line 6) | def sample_with_temperature(logits, sampling_temp, keep_topk): class RandomSampling (line 59) | class RandomSampling(DecodeStrategy): method __init__ (line 86) | def __init__(self, pad, bos, eos, batch_size, device, method advance (line 104) | def advance(self, log_probs, attn): method update_finished (line 132) | def update_finished(self): FILE: onmt/translate/translation.py class TranslationBuilder (line 8) | class TranslationBuilder(object): method __init__ (line 24) | def __init__(self, data, fields, n_best=1, replace_unk=False, method _build_target_tokens (line 35) | def _build_target_tokens(self, src, src_vocab, src_raw, pred, attn): method from_batch (line 59) | def from_batch(self, translation_batch): class Translation (line 113) | class Translation(object): method __init__ (line 130) | def __init__(self, src, src_raw, pred_sents, method log (line 140) | def log(self, sent_number): FILE: onmt/translate/translation_server.py function critical (line 22) | def critical(func): class Timer (line 42) | class Timer: method __init__ (line 43) | def __init__(self, start=False): method start (line 50) | def start(self): method tick (line 55) | def tick(self, name=None, tot=False): class ServerModelError (line 68) | class ServerModelError(Exception): class TranslationServer (line 72) | class TranslationServer(object): method __init__ (line 73) | def __init__(self): method start (line 77) | def start(self, config_file): method clone_model (line 104) | def clone_model(self, model_id, opt, timeout=-1): method load_model (line 118) | def load_model(self, opt, model_id=None, **model_kwargs): method preload_model (line 126) | def preload_model(self, opt, model_id=None, **model_kwargs): method run (line 145) | def run(self, inputs): method unload_model (line 161) | def unload_model(self, model_id): method list_models (line 172) | def list_models(self): class ServerModel (line 181) | class ServerModel(object): method __init__ (line 197) | def __init__(self, opt, model_id, tokenizer_opt=None, load=False, method parse_opt (line 229) | def parse_opt(self, opt): method loaded (line 268) | def loaded(self): method load (line 271) | def load(self): method run (line 330) | def run(self, inputs): method do_timeout (line 437) | def do_timeout(self): method unload (line 453) | def unload(self): method stop_unload_timer (line 460) | def stop_unload_timer(self): method reset_unload_timer (line 464) | def reset_unload_timer(self): method to_dict (line 472) | def to_dict(self): method to_cpu (line 486) | def to_cpu(self): method to_gpu (line 492) | def to_gpu(self): method maybe_tokenize (line 497) | def maybe_tokenize(self, sequence): method tokenize (line 507) | def tokenize(self, sequence): method maybe_detokenize (line 528) | def maybe_detokenize(self, sequence): method detokenize (line 538) | def detokenize(self, sequence): FILE: onmt/translate/translator.py function build_translator (line 22) | def build_translator(opt, report_score=True, logger=None, out_file=None): class Translator (line 45) | class Translator(object): method __init__ (line 86) | def __init__( method from_opt (line 187) | def from_opt( method _log (line 247) | def _log(self, msg): method _gold_score (line 253) | def _gold_score(self, batch, memory_bank, src_lengths, src_vocabs, method translate (line 264) | def translate( method _translate_random_sampling (line 411) | def _translate_random_sampling( method translate_batch (line 503) | def translate_batch(self, batch, src_vocabs, attn_debug): method _run_encoder (line 525) | def _run_encoder(self, batch): method _decode_and_generate (line 540) | def _decode_and_generate( method _translate_batch (line 598) | def _translate_batch( method _translate_batch_deprecated (line 716) | def _translate_batch_deprecated(self, batch, src_vocabs): method _score_target (line 810) | def _score_target(self, batch, memory_bank, src_lengths, method _report_score (line 826) | def _report_score(self, name, score_total, words_total): method _report_bleu (line 835) | def _report_bleu(self, tgt_path): method _report_rouge (line 850) | def _report_rouge(self, tgt_path): FILE: 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: 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: 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: onmt/utils/logging.py function init_logger (line 9) | def init_logger(log_file=None, log_file_level=logging.NOTSET): FILE: onmt/utils/loss.py function build_loss_compute (line 16) | def build_loss_compute(model, tgt_field, opt, train=True): class LossComputeBase (line 70) | class LossComputeBase(nn.Module): method __init__ (line 89) | def __init__(self, criterion, generator): method padding_idx (line 95) | def padding_idx(self): method _make_shard_state (line 98) | def _make_shard_state(self, batch, output, range_, attns=None): method _compute_loss (line 112) | def _compute_loss(self, batch, output, target, **kwargs): method __call__ (line 125) | def __call__(self, method _stats (line 174) | def _stats(self, loss, scores, target): method _bottle (line 190) | def _bottle(self, _v): method _unbottle (line 193) | def _unbottle(self, _v, batch_size): class LabelSmoothingLoss (line 197) | class LabelSmoothingLoss(nn.Module): method __init__ (line 203) | def __init__(self, label_smoothing, tgt_vocab_size, ignore_index=-100): method forward (line 215) | def forward(self, output, target): class NMTLossCompute (line 227) | class NMTLossCompute(LossComputeBase): method __init__ (line 232) | def __init__(self, criterion, generator, normalization="sents", method _make_shard_state (line 237) | def _make_shard_state(self, batch, output, range_, attns=None): method _compute_loss (line 257) | def _compute_loss(self, batch, output, target, std_attn=None, method _compute_coverage_loss (line 274) | def _compute_coverage_loss(self, std_attn, coverage_attn): class SNILossCompute (line 280) | class SNILossCompute(nn.Module): method __init__ (line 281) | def __init__(self, criterion): method padding_idx (line 286) | def padding_idx(self): method compute_loss (line 289) | def compute_loss(self, predict_out, target): method update_state (line 297) | def update_state(self, loss, scores, target): function filter_shard_state (line 305) | def filter_shard_state(state, shard_size=None): function shards (line 320) | def shards(state, shard_size, eval_only=False): FILE: onmt/utils/misc.py function split_corpus (line 9) | def split_corpus(path, shard_size): function aeq (line 21) | def aeq(*args): function sequence_mask (line 31) | def sequence_mask(lengths, max_len=None): function tile (line 43) | def tile(x, count, dim=0): function use_gpu (line 65) | def use_gpu(opt): function set_random_seed (line 73) | def set_random_seed(seed, is_cuda): function generate_relative_positions_matrix (line 89) | def generate_relative_positions_matrix(length, max_relative_positions, function relative_matmul (line 107) | def relative_matmul(x, z, transpose): function fn_args (line 124) | def fn_args(fun): FILE: onmt/utils/optimizers.py function build_torch_optimizer (line 11) | def build_torch_optimizer(model, opt): function make_learning_rate_decay_fn (line 100) | def make_learning_rate_decay_fn(opt): function noam_decay (line 126) | def noam_decay(step, warmup_steps, model_size): function noamwd_decay (line 135) | def noamwd_decay(step, warmup_steps, function exponential_decay (line 145) | def exponential_decay(step, rate, decay_steps, start_step=0): function rsqrt_decay (line 152) | def rsqrt_decay(step, warmup_steps): class MultipleOptimizer (line 157) | class MultipleOptimizer(object): method __init__ (line 160) | def __init__(self, op): method param_groups (line 165) | def param_groups(self): method zero_grad (line 171) | def zero_grad(self): method step (line 176) | def step(self): method state (line 182) | def state(self): method state_dict (line 186) | def state_dict(self): method load_state_dict (line 190) | def load_state_dict(self, state_dicts): class Optimizer (line 197) | class Optimizer(object): method __init__ (line 206) | def __init__(self, method from_opt (line 230) | def from_opt(cls, model, opt, checkpoint=None): method training_step (line 282) | def training_step(self): method learning_rate (line 286) | def learning_rate(self): method state_dict (line 293) | def state_dict(self): method load_state_dict (line 300) | def load_state_dict(self, state_dict): method zero_grad (line 308) | def zero_grad(self): method backward (line 312) | def backward(self, loss): method step (line 322) | def step(self): class AdaFactor (line 349) | class AdaFactor(torch.optim.Optimizer): method __init__ (line 351) | def __init__(self, params, lr=None, beta1=0.9, beta2=0.999, eps1=1e-30, method __setstate__ (line 369) | def __setstate__(self, state): method _experimental_reshape (line 372) | def _experimental_reshape(self, shape): method _check_shape (line 384) | def _check_shape(self, shape): method _rms (line 398) | def _rms(self, x): method step (line 401) | def step(self, closure=None): FILE: 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 50) | def validate_model_opts(cls, model_opt): method ckpt_model_opts (line 68) | def ckpt_model_opts(cls, ckpt_opt): method validate_train_opts (line 77) | def validate_train_opts(cls, opt): method validate_translate_opts (line 106) | def validate_translate_opts(cls, opt): method validate_preprocess_args (line 111) | def validate_preprocess_args(cls, opt): FILE: onmt/utils/report_manager.py function build_report_manager (line 11) | def build_report_manager(opt): class ReportMgrBase (line 29) | class ReportMgrBase(object): method __init__ (line 37) | def __init__(self, report_every, start_time=-1.): method start (line 48) | def start(self): method log (line 51) | def log(self, *args, **kwargs): method report_training (line 54) | def report_training(self, step, num_steps, learning_rate, method _report_training (line 83) | def _report_training(self, *args, **kwargs): method report_step (line 87) | def report_step(self, lr, step, train_stats=None, valid_stats=None): method _report_step (line 99) | def _report_step(self, *args, **kwargs): class ReportMgr (line 103) | class ReportMgr(ReportMgrBase): method __init__ (line 104) | def __init__(self, report_every, start_time=-1., tensorboard_writer=No... method maybe_log_tensorboard (line 117) | def maybe_log_tensorboard(self, stats, prefix, learning_rate, step): method _report_training (line 122) | def _report_training(self, step, num_steps, learning_rate, method _report_step (line 141) | def _report_step(self, lr, step, train_stats=None, valid_stats=None): FILE: onmt/utils/rnn_factory.py function rnn_factory (line 8) | def rnn_factory(rnn_type, **kwargs): FILE: 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 output_sni (line 129) | def output_sni(self, step, num_steps, learning_rate, start): method log_tensorboard (line 147) | def log_tensorboard(self, prefix, writer, learning_rate, step):