parameters: (model, device, data, target)
return_statement: return torch.abs(grad)
docstring: Utility function to compute the gradients of the model on the
      given data.
docstring_summary: Utility function to compute the gradients of the model on the
      given data.
docstring_tokens: Utility function to compute the gradients of the model on the given data .
function: def get_gradients(model, device, data, target):
      """
      Utility function to compute the gradients of the model on the
      given data.
      """
      total_train_pts = len(data)
      data = data.to(torch.float)
      target = target.to(torch.float)
      target = torch.squeeze(target)
  
      #Extract the logits for cross entropy loss
      data_copy = data
      data_copy = data_copy.detach().requires_grad_()
      # logits = model(data_copy)
      logits = model(data_copy)
      logits = torch.squeeze(logits, dim = 1)
      ce_loss = F.binary_cross_entropy_with_logits(logits, target)
      
      grad = torch.autograd.grad(ce_loss, data_copy)[0]
  
      return torch.abs(grad)
function_tokens: def get_gradients ( model , device , data , target ) : total_train_pts = len ( data ) data = data . to ( torch . float ) target = target . to ( torch . float ) target = torch . squeeze ( target ) #Extract the logits for cross entropy loss data_copy = data data_copy = data_copy . detach ( ) . requires_grad_ ( ) # logits = model(data_copy) logits = model ( data_copy ) logits = torch . squeeze ( logits , dim = 1 ) ce_loss = F . binary_cross_entropy_with_logits ( logits , target ) grad = torch . autograd . grad ( ce_loss , data_copy ) [ 0 ] return torch . abs ( grad )