docstr: PyTorch implementation of padded_to_packed function.
docstr_tok: ["PyTorch","implementation","of","padded_to_packed","function","."]
code: def padded_to_packed_python(inputs, first_idxs, num_inputs, device):
      """
      PyTorch implementation of padded_to_packed function.
      """
      num_meshes = inputs.size(0)
      if inputs.dim() == 2:
          inputs_packed = torch.zeros((num_inputs,), device=device)
      else:
          inputs_packed = torch.zeros(
              (num_inputs, *inputs.shape[2:]), device=device
          )
      for m in range(num_meshes):
          s = first_idxs[m]
          if m == num_meshes - 1:
              f = num_inputs
          else:
              f = first_idxs[m + 1]
          inputs_packed[s:f] = inputs[m, : f - s]
  
      return inputs_packed
  
imports: import unittest
  import torch
  from pytorch3d.ops import packed_to_padded, padded_to_packed
  from pytorch3d.structures.meshes import Meshes
  from .common_testing import get_random_cuda_device, TestCaseMixin
label_desc: Use image node_id 4 for calling the TestPackedToPadded obj's underlying member method code with example usage: obj.padded_to_packed_python(inputs, first_idxs, num_inputs, device) and returns: inputs_packed