class_docstr: Compute the log-likelihood of the input assuming a conditional random field
  model.
  
  Args:
      num_tags: The number of tags
class_docstr_tok: ["Compute","the","log-likelihood","of","the","input","assuming","a","conditional","random","field","model",".","Args",":","num_tags",":","The","number","of","tags"]
docstr: Exports the crf layer to caffe2 by manually adding the necessary operators
  to the init_net and predict net.
  
  Args:
      init_net: caffe2 init net created by the current graph
      predict_net: caffe2 net created by the current graph
      workspace: caffe2 current workspace
      output_names: current output names of the caffe2 net
      py_model: original pytorch model object
  
  Returns:
      string: The updated predictions blob name
docstr_tok: ["Exports","the","crf","layer","to","caffe2","by","manually","adding","the","necessary","operators","to","the","init_net","and","predict","net",".","Args",":","init_net",":","caffe2","init","net","created","by","the","current","graph","predict_net",":","caffe2","net","created","by","the","current","graph","workspace",":","caffe2","current","workspace","output_names",":","current","output","names","of","the","caffe2","net","py_model",":","original","pytorch","model","object","Returns",":","string",":","The","updated","predictions","blob","name"]
code: def export_to_caffe2(
      self, workspace, init_net, predict_net, logits_output_name
  ):
      """
      Exports the crf layer to caffe2 by manually adding the necessary operators
      to the init_net and predict net.
  
      Args:
          init_net: caffe2 init net created by the current graph
          predict_net: caffe2 net created by the current graph
          workspace: caffe2 current workspace
          output_names: current output names of the caffe2 net
          py_model: original pytorch model object
  
      Returns:
          string: The updated predictions blob name
      """
      crf_transitions = init_net.AddExternalInput(init_net.NextName())
      workspace.FeedBlob(
          str(crf_transitions), self.get_transitions().numpy()
      )
      logits_squeezed = predict_net.Squeeze(
          logits_output_name, dims=[0]
      )
      new_logits = apply_crf(
          init_net,
          predict_net,
          crf_transitions,
          logits_squeezed,
          self.num_tags,
      )
      new_logits = predict_net.ExpandDims(new_logits, dims=[0])
      predict_net.Copy(new_logits, logits_output_name)
      return logits_output_name
  
imports: from typing import List
  import torch
  import torch.jit
  import torch.nn
  from caffe2.python.crf_predict import apply_crf
  from pytext.utils.usage import log_class_usage
label_desc: Use image node_id 13 for calling the CRF obj's underlying member method code with example usage: obj.export_to_caffe2(workspace, init_net, predict_net, logits_output_name) and returns: logits_output_name