code: def convert_to_tensors_and_broadcast(
      *args,
      dtype: torch.dtype = torch.float32,
      device: Device = "cpu",
  ):
      """
      Helper function to handle parsing an arbitrary number of inputs (*args)
      which all need to have the same batch dimension.
      The output is a list of tensors.
  
      Args:
          *args: an arbitrary number of inputs
              Each of the values in `args` can be one of the following
                  - Python scalar
                  - Torch scalar
                  - Torch tensor of shape (N, K_i) or (1, K_i) where K_i are
                    an arbitrary number of dimensions which can vary for each
                    value in args. In this case each input is broadcast to a
                    tensor of shape (N, K_i)
          dtype: data type to use when creating new tensors.
          device: torch device on which the tensors should be placed.
  
      Output:
          args: A list of tensors of shape (N, K_i)
      """
      # Convert all inputs to tensors with a batch dimension
      args_1d = [format_tensor(c, dtype, device) for c in args]
  
      # Find broadcast size
      sizes = [c.shape[0] for c in args_1d]
      N = max(sizes)
  
      args_Nd = []
      for c in args_1d:
          if c.shape[0] != 1 and c.shape[0] != N:
              msg = "Got non-broadcastable sizes %r" % sizes
              raise ValueError(msg)
  
          # Expand broadcast dim and keep non broadcast dims the same size
          expand_sizes = (N,) + (-1,) * len(c.shape[1:])
          args_Nd.append(c.expand(*expand_sizes))
  
      return args_Nd
  
imports: import copy
  import inspect
  import warnings
  from typing import Any, List, Optional, Tuple, TypeVar, Union
  import numpy
  import torch
  import torch.nn
  from ..common.datatypes import Device, make_device
label_desc: Use image node_id 2 for calling a global function with example usage: convert_to_tensors_and_broadcast() and returns: args_Nd