code: def test_padded_to_packed(self):
      # Case where each face in the mesh has 3 unique uv vertex indices
      # - i.e. even if a vertex is shared between multiple faces it will
      # have a unique uv coordinate for each face.
      num_verts_per_mesh = [9, 6]
      D = 10
      verts_features_list = [
          torch.rand(v, D) for v in num_verts_per_mesh
      ]
      verts_features_packed = list_to_packed(verts_features_list)[0]
      verts_features_list = packed_to_list(
          verts_features_packed, num_verts_per_mesh
      )
      tex = TexturesVertex(verts_features=verts_features_list)
  
      # This is set inside Meshes when textures is passed as an input.
      # Here we set _num_faces_per_mesh and _num_verts_per_mesh explicity.
      tex1 = tex.clone()
      tex1._num_verts_per_mesh = num_verts_per_mesh
      verts_packed = tex1.verts_features_packed()
      verts_verts_list = tex1.verts_features_list()
      verts_padded = tex1.verts_features_padded()
  
      for f1, f2 in zip(verts_verts_list, verts_features_list):
          self.assertTrue((f1 == f2).all().item())
  
      self.assertTrue(
          verts_packed.shape == (sum(num_verts_per_mesh), D)
      )
      self.assertTrue(verts_padded.shape == (2, 9, D))
  
      # Case where num_verts_per_mesh is not set and textures
      # are initialized with a padded tensor.
      tex2 = TexturesVertex(verts_features=verts_padded)
      verts_packed = tex2.verts_features_packed()
      verts_list = tex2.verts_features_list()
  
      # Packed is just flattened padded as num_verts_per_mesh
      # has not been provided.
      self.assertTrue(verts_packed.shape == (9 * 2, D))
  
      for i, (f1, f2) in enumerate(
          zip(verts_list, verts_features_list)
      ):
          n = num_verts_per_mesh[i]
          self.assertTrue((f1[:n] == f2).all().item())
  
imports: import unittest
  import torch
  import torch.nn.functional
  from pytorch3d.renderer.mesh.rasterizer import Fragments
  from pytorch3d.renderer.mesh.textures import _list_to_padded_wrapper, TexturesAtlas, TexturesUV, TexturesVertex
  from pytorch3d.renderer.mesh.utils import pack_rectangles, pack_unique_rectangles, Rectangle
  from pytorch3d.structures import list_to_packed, Meshes, packed_to_list
  from .common_testing import TestCaseMixin
  from .test_meshes import init_mesh
label_desc: Use image node_id 9 for calling the TestTexturesVertex obj's underlying member method code with example usage: obj.test_padded_to_packed() without return types