code: def shape_tensor(sizes: Sequence[int | ir.Value]) -> ir.Value:
      int1d = shape_dtype_to_ir_type((1,), np.int32)
      i32_type = shape_dtype_to_ir_type((), np.int32)
  
      def dim_to_i32x1(d):
          if type(d) is int:
              return hlo_const(np.array([d], dtype=np.int32))
          else:
              if d.type != i32_type:
                  d = hlo.convert(i32_type, d)
              return hlo.reshape(int1d, d)
  
      ds = [dim_to_i32x1(sz) for sz in sizes]
      if not ds:
          return hlo_const(np.array([], np.int32))
      elif len(ds) == 1:
          return ds[0]
      else:
          return hlo.concatenate(
              ds, ir.IntegerAttr.get(ir.IntegerType.get_signless(64), 0)
          )
  
file_path: jax/jaxlib/hlo_helpers.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  from functools import partial
  from typing import Callable, Union
  import jaxlib.mlir.ir
  import jaxlib.mlir.dialects.stablehlo
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: shape_tensor(sizes) and returns: hlo_const, hlo_const, hlo, ds, hlo