def get_pooled_out(self, summary_type, use_summ_proj=True): """ Args: summary_type: str, "last", "first", "mean", or "attn". The method to pool the input to get a vector representation. use_summ_proj: bool, whether to use a linear projection during pooling. Returns: float32 Tensor in shape [bsz, d_model], the pooled representation. """ xlnet_config = self.xlnet_config run_config = self.run_config with tf.variable_scope("model", reuse=tf.AUTO_REUSE): summary = modeling.summarize_sequence( summary_type=summary_type, hidden=self.output, d_model=xlnet_config.d_model, n_head=xlnet_config.n_head, d_head=xlnet_config.d_head, dropout=run_config.dropout, dropatt=run_config.dropatt, is_training=run_config.is_training, input_mask=self.input_mask, initializer=self.initializer, use_proj=use_summ_proj) return summary
def get_pooled_out(self, summary_type, use_summ_proj=True): """ Args: summary_type: str, "last", "first", "mean", or "attn". The method to pool the input to get a vector representation. use_summ_proj: bool, whether to use a linear projection during pooling. Returns: float32 Tensor in shape [bsz, d_model], the pooled representation. """ summary = modeling.summarize_sequence( summary_type=summary_type, hidden=self.output, d_model=self._d_model, n_head=self._n_head, d_head=self._d_head, dropout=self._dropout, dropatt=self._dropatt, input_mask=self.input_mask, initializer=self._param_initializer, use_proj=use_summ_proj, name='model_sequnece_summary') return summary