code: def pad(seqs, round_to=1, *, threads_per_block=128, num_blocks=128):
      if round_to < 1:
          raise ValueError(
              f"Rounding for padding must at least be 1, was: {round_to}"
          )
      for seq in seqs:
          _is_float_or_int_array(seq)
  
      seq_lens = [len(seq) for seq in seqs]
      max_seq_len = max(seq_lens)
      # Round the length to nearest bucket -- helps on GPU, to make similar
      # array sizes.
      max_seq_len += -max_seq_len % round_to
      seq_lens = cupy.array(seq_lens, dtype="int32")
      final_shape = (len(seqs), max_seq_len) + seqs[0].shape[1:]
      out = cupy.empty(final_shape, dtype=seqs[0].dtype)
  
      # Extract pointers from CuPy arrays, so that we can address
      # them in the CUDA kernel.
      ptrs = numpy.empty(
          (
              len(
                  seqs,
              )
          ),
          "int64",
      )
      for idx, seq in enumerate(seqs):
          ptrs[idx] = seq.data.ptr
      ptrs = cupy.array(ptrs)
  
      stride = reduce(operator.mul, seqs[0].shape[1:], 1)
  
      if out.dtype == "float32":
          pad_kernel_float(
              (num_blocks,),
              (threads_per_block,),
              (out, ptrs, seq_lens, stride, len(seqs), max_seq_len),
          )
      elif out.dtype == "float64":
          pad_kernel_double(
              (num_blocks,),
              (threads_per_block,),
              (out, ptrs, seq_lens, stride, len(seqs), max_seq_len),
          )
      elif out.dtype == "int32":
          pad_kernel_int32(
              (num_blocks,),
              (threads_per_block,),
              (out, ptrs, seq_lens, stride, len(seqs), max_seq_len),
          )
      elif out.dtype == "int64":
          pad_kernel_int64(
              (num_blocks,),
              (threads_per_block,),
              (out, ptrs, seq_lens, stride, len(seqs), max_seq_len),
          )
  
      return out
  
imports: import operator
  import re
  from collections import defaultdict
  from functools import reduce
  from pathlib import Path
  from typing import Callable, Optional, Tuple
  import numpy
  from ..compat import cupy, has_cupy_gpu
label_desc: Use image node_id 4 for calling a global function with example usage: pad(seqs, round_to) and returns: out