rasa/core/policies/embedding_policy.py
def _embed_dialogue_from(self,
                             cell_output: tf.Tensor) -> tf.Tensor:
        """Extract or calculate dialogue level embedding from cell_output."""

        if self.attn_after_rnn:
            # embedding layer is inside rnn cell
            embed_dialogue = cell_output[:, :, :self.embed_dim]

            # extract additional debug tensors
            num_add = TimeAttentionWrapper.additional_output_size()
            self.rnn_embed = cell_output[
                :,
                :,
                self.embed_dim:(self.embed_dim + self.embed_dim)]
            self.attn_embed = cell_output[
                :,
                :,
                (self.embed_dim + self.embed_dim):-num_add]
        else:
            # add embedding layer to rnn cell output
            embed_dialogue = self._create_embed(
                cell_output[:, :, :self.rnn_size],
                layer_name_suffix='out'
            )
            if self.attn_before_rnn:
                # extract additional debug tensors
                self.attn_embed = cell_output[:, :, self.rnn_size:]

        return embed_dialogue
Extract or calculate dialogue level embedding from cell_output.
Extract or calculate dialogue level embedding from cell_output.
Extract or calculate dialogue level embedding from cell_output .
def _embed_dialogue_from(self,
                             cell_output: tf.Tensor) -> tf.Tensor:
        if self.attn_after_rnn:
            embed_dialogue = cell_output[:, :, :self.embed_dim]
            num_add = TimeAttentionWrapper.additional_output_size()
            self.rnn_embed = cell_output[
                :,
                :,
                self.embed_dim:(self.embed_dim + self.embed_dim)]
            self.attn_embed = cell_output[
                :,
                :,
                (self.embed_dim + self.embed_dim):-num_add]
        else:
            embed_dialogue = self._create_embed(
                cell_output[:, :, :self.rnn_size],
                layer_name_suffix='out'
            )
            if self.attn_before_rnn:
                self.attn_embed = cell_output[:, :, self.rnn_size:]
        return embed_dialogue
def _embed_dialogue_from ( self , cell_output : tf . Tensor ) -> tf . Tensor : if self . attn_after_rnn : embed_dialogue = cell_output [ : , : , : self . embed_dim ] num_add = TimeAttentionWrapper . additional_output_size ( ) self . rnn_embed = cell_output [ : , : , self . embed_dim : ( self . embed_dim + self . embed_dim ) ] self . attn_embed = cell_output [ : , : , ( self . embed_dim + self . embed_dim ) : - num_add ] else : embed_dialogue = self . _create_embed ( cell_output [ : , : , : self . rnn_size ] , layer_name_suffix = 'out' ) if self . attn_before_rnn : self . attn_embed = cell_output [ : , : , self . rnn_size : ] return embed_dialogue
Extract or calculate dialogue level embedding from cell_output.
Extract or calculate dialogue level embedding from cell_output .
"""Extract or calculate dialogue level embedding from cell_output.""" # embedding layer is inside rnn cell # extract additional debug tensors # add embedding layer to rnn cell output # extract additional debug tensors
self
cell_output
tf.Tensor