rasa/core/policies/embedding_policy.py
def rnn_and_attn_inputs_fn(self,
                               inputs: tf.Tensor,
                               cell_state: tf.Tensor
                               ) -> Tuple[tf.Tensor, tf.Tensor]:
        """Construct rnn input and attention mechanism input.

        Args:
          inputs: Tensor, concatenated all embeddings for one time step:
                  [embed_utter, embed_slots, embed_prev_action].

          cell_state: Tensor, state of an rnn cell.

        Returns:
          Tuple of Tensors `rnn_inputs, attn_inputs` to feed to
          rnn and attention mechanisms.
        """

        # the hidden state c and slots are not included,
        # in hope that algorithm would learn correct attention
        # regardless of the hidden state c of an lstm and slots
        if isinstance(cell_state, tf.contrib.rnn.LSTMStateTuple):
            attn_inputs = tf.concat([inputs[:, :self.embed_dim],
                                     cell_state.h], -1)
        else:
            attn_inputs = tf.concat([inputs[:, :self.embed_dim],
                                     cell_state], -1)

        # include slots in inputs but exclude previous action, since
        # rnn should get previous action from its hidden state
        rnn_inputs = inputs[:, :(self.embed_dim +
                                 self.embed_dim)]

        return rnn_inputs, attn_inputs
Construct rnn input and attention mechanism input.

        Args:
          inputs: Tensor, concatenated all embeddings for one time step:
                  [embed_utter, embed_slots, embed_prev_action].

          cell_state: Tensor, state of an rnn cell.

        Returns:
          Tuple of Tensors `rnn_inputs, attn_inputs` to feed to
          rnn and attention mechanisms.
        
Construct rnn input and attention mechanism input.
Construct rnn input and attention mechanism input .
def rnn_and_attn_inputs_fn(self,
                               inputs: tf.Tensor,
                               cell_state: tf.Tensor
                               ) -> Tuple[tf.Tensor, tf.Tensor]:
        if isinstance(cell_state, tf.contrib.rnn.LSTMStateTuple):
            attn_inputs = tf.concat([inputs[:, :self.embed_dim],
                                     cell_state.h], -1)
        else:
            attn_inputs = tf.concat([inputs[:, :self.embed_dim],
                                     cell_state], -1)
        rnn_inputs = inputs[:, :(self.embed_dim +
                                 self.embed_dim)]
        return rnn_inputs, attn_inputs
def rnn_and_attn_inputs_fn ( self , inputs : tf . Tensor , cell_state : tf . Tensor ) -> Tuple [ tf . Tensor , tf . Tensor ] : if isinstance ( cell_state , tf . contrib . rnn . LSTMStateTuple ) : attn_inputs = tf . concat ( [ inputs [ : , : self . embed_dim ] , cell_state . h ] , - 1 ) else : attn_inputs = tf . concat ( [ inputs [ : , : self . embed_dim ] , cell_state ] , - 1 ) rnn_inputs = inputs [ : , : ( self . embed_dim + self . embed_dim ) ] return rnn_inputs , attn_inputs
Construct rnn input and attention mechanism input.
Construct rnn input and attention mechanism input .
"""Construct rnn input and attention mechanism input.

        Args:
          inputs: Tensor, concatenated all embeddings for one time step:
                  [embed_utter, embed_slots, embed_prev_action].

          cell_state: Tensor, state of an rnn cell.

        Returns:
          Tuple of Tensors `rnn_inputs, attn_inputs` to feed to
          rnn and attention mechanisms.
        """ # the hidden state c and slots are not included, # in hope that algorithm would learn correct attention # regardless of the hidden state c of an lstm and slots # include slots in inputs but exclude previous action, since # rnn should get previous action from its hidden state
Tuple of Tensors `rnn_inputs, attn_inputs` to feed to
rnn and attention mechanisms.
Tuple of Tensors ` rnn_inputs attn_inputs ` to feed to rnn and attention mechanisms .
self
inputs
tf.Tensor
Tensor, concatenated all embeddings for one time step:
[embed_utter, embed_slots, embed_prev_action].
Tensor concatenated all embeddings for one time step : [ embed_utter embed_slots embed_prev_action ] .
cell_state
tf.Tensor
Tensor, state of an rnn cell.
Tensor state of an rnn cell .