Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
caffe2.python.models.seq2seq.beam_search.BeamSearchForwardOnly Class Reference
Inheritance diagram for caffe2.python.models.seq2seq.beam_search.BeamSearchForwardOnly:

Public Member Functions

def __init__ (self, beam_size, model, eos_token_id, go_token_id=seq2seq_util.GO_ID, post_eos_penalty=None)
 
def get_step_model (self)
 
def get_previous_tokens (self)
 
def get_timestep (self)
 
def apply (self, inputs, length, log_probs, attentions, state_configs, data_dependencies, word_rewards=None, possible_translation_tokens=None, go_token_id=None)
 

Public Attributes

 beam_size
 
 model
 
 step_model
 
 go_token_id
 
 eos_token_id
 
 post_eos_penalty
 

Static Public Attributes

 LinkConfig = namedtuple('LinkConfig', ['blob', 'offset', 'window'])
 
 StateConfig
 

Detailed Description

Class generalizing forward beam search for seq2seq models.

Also provides types to specify the recurrent structure of decoding:

StateConfig:
    initial_value: blob providing value of state at first step_model
    state_prev_link: LinkConfig describing how recurrent step receives
        input from global state blob in each step
    state_link: LinkConfig describing how step writes (produces new state)
        to global state blob in each step

LinkConfig:
    blob: blob connecting global state blob to step application
    offset: offset from beginning of global blob for link in time dimension
    window: width of global blob to read/write in time dimension

Definition at line 14 of file beam_search.py.

Member Data Documentation

caffe2.python.models.seq2seq.beam_search.BeamSearchForwardOnly.StateConfig
static
Initial value:
1 = namedtuple(
2  'StateConfig',
3  ['initial_value', 'state_prev_link', 'state_link'],
4  )

Definition at line 35 of file beam_search.py.


The documentation for this class was generated from the following file: