code: def zip_infshape(base_dims, dims, fin_if_same=True):
      infshape = []
      for bd, d in zip(base_dims, dims):
          if isinstance(bd, InfDim):
              # retain bd's base_dim but overwrite dim
              infdim = copy(bd)
              infdim.dim = d
              infshape.append(infdim)
          elif isinstance(bd, int):
              if bd == d and fin_if_same:
                  infshape.append(InfDim(None, d))
              else:
                  infshape.append(InfDim(bd, d))
          else:
              raise ValueError(f"unhandled base_dim type: {type(bd)}")
      return InfShape(infshape)
  
imports: from copy import copy
label_desc: Use image node_id 1 for calling a global function with example usage: zip_infshape(base_dims, dims, fin_if_same) and returns: InfShape