class_docstr: Wrapper around the base model for custom training logic.
code: def compute_loss(self, x, y, sample_weight, training=False):
      y_pred = self(x, training=training)
      _, potentials, sequence_length, chain_kernel = y_pred
  
      # we now add the CRF loss:
      crf_loss = -crf_log_likelihood(
          potentials, y, sequence_length, chain_kernel
      )[0]
  
      if sample_weight is not None:
          crf_loss = crf_loss * sample_weight
  
      return tf.reduce_mean(crf_loss), sum(self.losses)
  
imports: import itertools
  import os
  import math
  import tempfile
  import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.layers.crf import CRF
  from tensorflow_addons.text.crf import crf_log_likelihood
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 3 for calling the ModelWithCRFLoss obj's underlying member method code with example usage: obj.compute_loss(x, y, sample_weight, training) and returns: tf,  sum