class_docstr: Create confusion matrices using the `PyCM library <https://github.com/sepandhaghighi/pycm>`_.
  
  Args:
      kwargs: Additional keyword args to pass to the `ConfusionMatrix` call
docstr: Send `ConfusionMatrix` objects from this callback to the given state key
  
  Args:
      key (StateKey): The key to store the confusion matrix in
  
  Returns:
      PyCM: self
docstr_tok: ["Send","`","ConfusionMatrix","`","objects","from","this","callback","to","the","given","state","key","Args",":","key","(","StateKey",")",":","The","key","to","store","the","confusion","matrix","in","Returns",":","PyCM",":","self"]
code: def to_state(self, key):
      """Send `ConfusionMatrix` objects from this callback to the given state key
  
      Args:
          key (StateKey): The key to store the confusion matrix in
  
      Returns:
          PyCM: self
      """
  
      def handler(cm, state):
          state[key] = cm
  
      return self.with_handler(handler)
  
imports: from __future__ import print_function
  import torch
  import torchbearer
  from torchbearer import Callback
  from torchbearer.bases import cite
  from torchbearer.metrics import EpochLambda, MetricList
label_desc: Use image node_id 7 for calling the PyCM obj's underlying member method code with example usage: obj.to_state(key) and returns: self