class_docstr: BC+ callback which mixes images by treating them as waveforms. For standard BC, see :class:`.Mixup`.
  This callback can optionally convert labels to one hot before combining them according to the lambda parameters,
  sampled from a beta distribution, use alpha=1 to replicate the paper. Use with :meth:`BCPlus.bc_loss` or set
  `mixup_loss = True` and use :meth:`.Mixup.mixup_loss`.
  
  .. note::
  
     This callback first sets all images to have zero mean. Consider adding an offset (e.g. 0.5) back before
     visualising.
  
  Example: ::
  
      >>> from torchbearer import Trial
      >>> from torchbearer.callbacks import BCPlus
  
      # Example Trial which does BCPlus regularisation
      >>> bcplus = BCPlus(classes=10)
      >>> trial = Trial(None, criterion=BCPlus.bc_loss, callbacks=[bcplus], metrics=['acc'])
  
  Args:
      mixup_loss (bool): If True, the lambda and targets will be stored for use with the mixup loss function.
      alpha (float): The alpha value for the beta distribution.
      classes (int): The number of classes for conversion to one hot.
  
  State Requirements:
      - :attr:`torchbearer.state.X`: State should have the current data stored and correctly normalised
      - :attr:`torchbearer.state.Y_TRUE`: State should have the current data stored
class_docstr_tok: ["BC+","callback","which","mixes","images","by","treating","them","as","waveforms",".","For","standard","BC",",","see",":","class",":","`",".Mixup","`",".","This","callback","can","optionally","convert","labels","to","one","hot","before","combining","them","according","to","the","lambda","parameters",",","sampled","from","a","beta","distribution",",","use","alpha=1","to","replicate","the","paper",".","Use","with",":","meth",":","`","BCPlus.bc_loss","`","or","set","`","mixup_loss","=","True","`","and","use",":","meth",":","`",".Mixup.mixup_loss","`",".","..","note",":",":","This","callback","first","sets","all","images","to","have","zero","mean",".","Consider","adding","an","offset","(","e.g",".","0.5",")","back","before","visualising",".","Example",":",":",":",">",">",">","from","torchbearer","import","Trial",">",">",">","from","torchbearer.callbacks","import","BCPlus","#","Example","Trial","which","does","BCPlus","regularisation",">",">",">","bcplus","=","BCPlus","(","classes=10",")",">",">",">","trial","=","Trial","(","None",",","criterion=BCPlus.bc_loss",",","callbacks=","[","bcplus","]",",","metrics=","[","'acc","'","]",")","Args",":","mixup_loss","(","bool",")",":","If","True",",","the","lambda","and","targets","will","be","stored","for","use","with","the","mixup","loss","function",".","alpha","(","float",")",":","The","alpha","value","for","the","beta","distribution",".","classes","(","int",")",":","The","number","of","classes","for","conversion","to","one","hot",".","State","Requirements",":","-",":","attr",":","`","torchbearer.state.X","`",":","State","should","have","the","current","data","stored","and","correctly","normalised","-",":","attr",":","`","torchbearer.state.Y_TRUE","`",":","State","should","have","the","current","data","stored"]
code: def _to_one_hot(self, target):
      if target.dim() == 1:
          target = target.unsqueeze(1)
          one_hot = torch.zeros_like(target).repeat(1, self.classes)
          one_hot.scatter_(1, target, 1)
          return one_hot
      return target.float()
  
file_path: torchbearer/torchbearer/callbacks/between_class.py
imports: import torchbearer
  from torchbearer import Callback
  import torch
  import torch.nn.functional
  from torch.distributions import Beta
  from torchbearer.bases import cite
label_desc: Use image node_id 3 for calling the BCPlus obj's underlying member method code with example usage: obj._to_one_hot(target) and returns: target, one_hot