Home / Function/ bytes_to_hex_array() — pytorch Function Reference

bytes_to_hex_array() — pytorch Function Reference

Architecture documentation for the bytes_to_hex_array() function in generate_aiter_embedded_hsa.py from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  e5d0b52f_f0aa_0c42_3941_f2d1d6568b52["bytes_to_hex_array()"]
  45a8c845_25fb_a7fb_78e2_dec6d2d767fd["generate_embedded_hsa_header()"]
  45a8c845_25fb_a7fb_78e2_dec6d2d767fd -->|calls| e5d0b52f_f0aa_0c42_3941_f2d1d6568b52
  style e5d0b52f_f0aa_0c42_3941_f2d1d6568b52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

aten/src/ATen/native/transformers/hip/flash_attn/ck/fav_v3/generate_aiter_embedded_hsa.py lines 16–25

def bytes_to_hex_array(data: bytes, bytes_per_line: int = 16) -> str:
    """Convert bytes to a formatted C hex array string."""
    hex_bytes = []
    for i, byte in enumerate(data):
        if i > 0 and i % bytes_per_line == 0:
            hex_bytes.append("\n    ")
        hex_bytes.append(f"0x{byte:02x}")
        if i < len(data) - 1:
            hex_bytes.append(",")
    return "".join(hex_bytes)

Subdomains

Frequently Asked Questions

What does bytes_to_hex_array() do?
bytes_to_hex_array() is a function in the pytorch codebase.
What calls bytes_to_hex_array()?
bytes_to_hex_array() is called by 1 function(s): generate_embedded_hsa_header.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free