caca2348bd54ec25d71ee05fd2a58e12db39f2e4,texar/modules/decoders/rnn_decoder_base.py,RNNDecoderBase,__init__,#RNNDecoderBase#Any#Any#Any#Any#,35

Before Change


                 hparams=None):
        ModuleBase.__init__(self, hparams)

        self._helper = None
        self._initial_state = None

        // Make rnn cell
        with tf.variable_scope(self.variable_scope):
            if cell is not None:
                self._cell = cell
            else:
                self._cell = layers.get_rnn_cell(self._hparams.rnn_cell)

        //self._external_cell_given = False
        //if cell is not None:
        //    self._cell = cell
        //    self._external_cell_given = True

        // Make the output layer
        self._vocab_size = vocab_size
        self._output_layer = output_layer
        if output_layer is None:
            if self._vocab_size is None:
                raise ValueError(
                    "Either `output_layer` or `vocab_size` must be provided. "
                    "Set `output_layer=tf.identity` if no output layer is "
                    "wanted.")
            with tf.variable_scope(self.variable_scope):
                self._output_layer = tf.layers.Dense(units=self._vocab_size)
        elif output_layer is not tf.identity:
            if not isinstance(output_layer, tf.layers.Layer):
                raise ValueError(
                    "`output_layer` must be either `tf.identity` or "

After Change


        return self._helper.batch_size

    @property
    def output_size(self):
        Output size of one step.
        
        raise NotImplementedError

    @property
    def output_dtype(self):
        Types of output of one step.
        
        raise NotImplementedError

    def initialize(self, name=None):
        // Inherits from TFDecoder
        // All RNN decoder classes must implement this
        raise NotImplementedError

    def step(self, time, inputs, state, name=None):
        // Inherits from TFDecoder
        // All RNN decoder classes must implement this
        raise NotImplementedError

    def finalize(self, outputs, final_state, sequence_lengths):
        // Inherits from TFDecoder
        // All RNN decoder classes must implement this
        raise NotImplementedError

    @property
    def cell(self):
        The RNN cell.
        
        return self._cell

    def zero_state(self, batch_size, dtype):
        Zero state of the rnn cell.

        Same as :attr:`decoder.cell.zero_state`.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: asyml/texar
Commit Name: caca2348bd54ec25d71ee05fd2a58e12db39f2e4
Time: 2018-03-24
Author: zhitinghu@gmail.com
File Name: texar/modules/decoders/rnn_decoder_base.py
Class Name: RNNDecoderBase
Method Name: __init__


Project Name: dmlc/gluon-nlp
Commit Name: 3c874575bf40e8b1fa2280371131a8f29ebb3e98
Time: 2020-07-28
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/models/albert.py
Class Name: AlbertModel
Method Name: __init__


Project Name: asyml/texar
Commit Name: caca2348bd54ec25d71ee05fd2a58e12db39f2e4
Time: 2018-03-24
Author: zhitinghu@gmail.com
File Name: texar/modules/decoders/rnn_decoder_base.py
Class Name: RNNDecoderBase
Method Name: __init__


Project Name: uber/ludwig
Commit Name: e9aea97df1dc7878827ac193ba75cbea0b3ee351
Time: 2020-05-05
Author: jimthompson5802@gmail.com
File Name: ludwig/models/modules/sequence_decoders.py
Class Name: SequenceGeneratorDecoder
Method Name: __init__