code: def to_triton_f8(x: torch.Tensor) -> triton.TensorWrapper:
      """Converts torch tensors to triton.language.float8e5."""
      assert (
          x.is_contiguous()
      ), "Kernel only works for contiguous tensors"
      ret = triton.reinterpret(
          torch.empty(
              x.shape,
              dtype=torch.int8,
              device=x.device,
              layout=x.layout,
          ),
          tl.float8e5,
      )
      grid = lambda META: (triton.cdiv(x.numel(), META["block_size"]),)
      _to_f8_kernel[grid](ret, x, x.numel(), block_size=1024)
      return ret
  
imports: import enum
  import itertools
  import logging
  import math
  import typing
  import torch
  import tqdm
  import triton
  import triton.language
label_desc: Use image node_id 8 for calling a global function with example usage: to_triton_f8(x) and returns: ret