code: def test_embeddingbag_include_last_offset(self):
      # Test case from https://github.com/pytorch/pytorch/issues/89677
      embeddingbag = nn.EmbeddingBag(
          100, 3, include_last_offset=True, padding_idx=61
      )
      input = torch.tensor([0, 1, 2, 3])
      out = embeddingbag(input, torch.tensor([0, 3, 3]))
      out2 = embeddingbag(input, torch.tensor([0, 3, 4]))
  
      weight = embeddingbag.weight
      row0 = weight[0:3].mean(0)
      row1 = weight[3]
      ref_out = torch.stack([row0, row1])
  
      self.assertEqual(ref_out, out)
      self.assertEqual(ref_out, out2)
  
imports: import unittest
  import random
  import itertools
  from itertools import product
  import torch
  from torch.testing._internal.common_utils import run_tests, set_default_dtype, skipIfTorchDynamo, instantiate_parametrized_tests, parametrize, _assertGradAndGradgradChecks, IS_JETSON
  from torch.testing._internal.common_cuda import TEST_CUDA
  from torch.testing._internal.common_nn import NNTestCase
  from torch.testing._internal.common_device_type import onlyNativeDeviceTypes, dtypes, instantiate_device_type_tests, dtypesIfCUDA, onlyCUDA, TEST_WITH_ROCM, skipCUDAIf, skipMeta
  import torch.nn.functional
  import torch.nn
  from torch.testing._internal.common_utils import dtype2prec_DONTUSE
label_desc: Use image node_id 16 for calling the TestEmbeddingNN obj's underlying member method code with example usage: obj.test_embeddingbag_include_last_offset() without return types