original_docstring: 
      Define loss function for CCA.
      
      :param out_dim: output dimension
      :param cca_weight: weight of cca loss
      :param criterion: criterion for supervised loss
      
docstring: Define loss function for CCA.
docstring_tokens: Define loss function for CCA .
code: def CCA_objective(out_dim, cca_weight=0.001, criterion=torch.nn.CrossEntropyLoss()):
      """
      Define loss function for CCA.
      
      :param out_dim: output dimension
      :param cca_weight: weight of cca loss
      :param criterion: criterion for supervised loss
      """
      lossfunc = CCALoss(out_dim, False, device=torch.device("cuda"))
  
      def actualfunc(pred, truth, args):
          ce_loss = _criterioning(pred, truth, criterion)
          outs = args['reps']
          cca_loss = lossfunc(outs[0], outs[1])
          return cca_loss * cca_weight + ce_loss
      return actualfunc
code_tokens: def CCA_objective ( out_dim , cca_weight = 0.001 , criterion = torch . nn . CrossEntropyLoss ( ) ) : lossfunc = CCALoss ( out_dim , False , device = torch . device ( "cuda" ) ) def actualfunc ( pred , truth , args ) : ce_loss = _criterioning ( pred , truth , criterion ) outs = args [ 'reps' ] cca_loss = lossfunc ( outs [ 0 ] , outs [ 1 ] ) return cca_loss * cca_weight + ce_loss return actualfunc
short_docstring: Define loss function for CCA.
short_docstring_tokens: Define loss function for CCA .
comment: """
      Define loss function for CCA.
      
      :param out_dim: output dimension
      :param cca_weight: weight of cca loss
      :param criterion: criterion for supervised loss
      """