class_docstr: Conditional Random Field layer (tf.keras)
  `CRF` can be used as the last layer in a network (as a classifier). Input shape (features)
  must be equal to the number of classes the CRF can predict (a linear layer is recommended).
  
  Note: the loss and accuracy functions of networks using `CRF` must
  use the provided loss and accuracy functions (denoted as loss and viterbi_accuracy)
  as the classification of sequences are used with the layers internal weights.
  
  Args:
      num_labels (int): the number of labels to tag each temporal input.
  
  Input shape:
      nD tensor with shape `(batch_size, sentence length, num_classes)`.
  
  Output shape:
      nD tensor with shape: `(batch_size, sentence length, num_classes)`.
code: def build(self, input_shape):
      assert len(input_shape) == 3
      f_shape = tf.TensorShape(input_shape)
      input_spec = tf.keras.layers.InputSpec(
          min_ndim=3, axes={-1: f_shape[-1]}
      )
  
      if f_shape[-1] is None:
          raise ValueError(
              "The last dimension of the inputs to `CRF` "
              "should be defined. Found `None`."
          )
      if f_shape[-1] != self.output_dim:
          raise ValueError(
              "The last dimension of the input shape must be equal to output"
              " shape. Use a linear layer if needed."
          )
      self.input_spec = input_spec
      self.transitions = self.add_weight(
          name="transitions",
          shape=[self.output_dim, self.output_dim],
          initializer="glorot_uniform",
          trainable=True,
      )
      self.built = True
  
file_path: nlp-architect/nlp_architect/nn/tensorflow/python/keras/layers/crf.py
imports: import tensorflow
label_desc: Use image node_id 3 for calling the CRF obj's underlying member method code with example usage: obj.build(input_shape) without return types