code: def set_loss_function(self, loss):
      if loss == "cross-entropy":
          self.loss_function = self.xe_loss_with_softmax
      elif loss == "bpr-max":
          self.loss_function = self.bpr_max_loss_with_elu
      elif loss == "top1":
          self.loss_function = self.top1
      else:
          raise NotImplementedError
  
imports: from collections import Counter
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Variable
  from torch.optim import Optimizer
  from cornac.utils.common import get_rng
label_desc: Use image node_id 3 for calling the GRU4RecModel obj's underlying member method code with example usage: obj.set_loss_function(loss) without return types