docstr: Computes the likelihood score for the given sequence of tags,
  given the provided logits, the transition weights in the CRF model
  and the label weights.
docstr_tok: ["Computes","the","likelihood","score","for","the","given","sequence","of","tags",",","given","the","provided","logits",",","the","transition","weights","in","the","CRF","model","and","the","label","weights","."]
code: def score_with_weights(self, logits, tags):
      """
      Computes the likelihood score for the given sequence of tags,
      given the provided logits, the transition weights in the CRF model
      and the label weights.
      """
      # Start with transitions from START and to END
      total = (
          self.transitions_from_start[tags[0]]
          + self.transitions_to_end[tags[-1]]
      )
      # Add in all the intermediate transitions
      for tag, next_tag in zip(tags, tags[1:]):
          total += self.transitions[tag, next_tag]
      # Add in the logits for the observed tags
      for logit, tag in zip(logits, tags):
          total += logit[tag] * self.label_weights[tag]
      return total
  
imports: import itertools
  import math
  from pytest import approx, raises
  import torch
  from numpy.testing import assert_allclose
  from allennlp.modules import ConditionalRandomField
  from allennlp.modules.conditional_random_field import ConditionalRandomFieldWeightEmission, ConditionalRandomFieldWeightTrans, ConditionalRandomFieldWeightLannoy
  from allennlp.modules.conditional_random_field.conditional_random_field import allowed_transitions
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
label_desc: Use image node_id 2 for calling the TestConditionalRandomFieldWeightEmission obj's underlying member method code with example usage: obj.score_with_weights(logits, tags) and returns: total