code: def test_gpt_no_pad_loss_masking():
      input_ids = [1] * 15 + [50257] * 15
      input_ids = torch.tensor(input_ids)
  
      input_attn_mask = [1] * 16 + [0] * 14
      input_attn_mask = torch.Tensor(input_attn_mask)
  
      training_mask_end = 10
  
      expected_labels = [-100] * 10 + [1] * 5 + [50257] + [-100] * 14
      expected_labels = torch.tensor(expected_labels)
  
      labels = GPTQADataset.update_labels_for_no_pad_loss(
          input_ids, training_mask_end, input_attn_mask
      )
  
      assert torch.all(labels.eq(expected_labels))
  
file_path: NeMo/tests/collections/nlp/test_qna.py
imports: import collections
  import pytest
  import torch
  from nemo.collections.nlp.data.question_answering.dataset.qa_dataset import QADataset
  from nemo.collections.nlp.data.question_answering.dataset.qa_gpt_dataset import GPTQADataset
  from nemo.collections.nlp.metrics.qa_metrics import QAMetrics
label_desc: Use image node_id 11 for calling a global function with example usage: test_gpt_no_pad_loss_masking() without return types