Пример #1
0
 def _fc_layer(self, embedding):
   """The fully connected layer to be finetuned."""
   with tf.variable_scope('fc_finetune', reuse=tf.AUTO_REUSE):
     logits = functional_classifiers.linear_classifier(
         embedding, self.logit_dim, self.cosine_classifier,
         self.cosine_logits_multiplier, self.use_weight_norm)
   return logits
Пример #2
0
    def forward_pass_fc(self, embeddings):
        """Passes the provided embeddings through the fc layer to get the logits.

    Args:
      embeddings: A Tensor of the penultimate layer activations as computed by
        BaselineLearner.forward_pass.

    Returns:
      The fc layer activations.
    """
        with tf.variable_scope('fc', reuse=tf.AUTO_REUSE):
            # Always maps to a space whose dimensionality is the number of classes
            # at meta-training time.
            logits = functional_classifiers.linear_classifier(
                embeddings, self.logit_dim, self.cosine_classifier,
                self.cosine_logits_multiplier, self.use_weight_norm)
            return logits