MCPcopy Create free account
hub / github.com/pytorch/executorch / patch_alignment

Function patch_alignment

exir/_serialize/_flatbuffer.py:63–69  ·  view source on GitHub ↗

Replaces an existing alignment with a new alignment.

(line: bytes, alignment: int)

Source from the content-addressed store, hash-verified

61 assert_valid_alignment(delegate_alignment, "delegate_alignment")
62
63 def patch_alignment(line: bytes, alignment: int) -> bytes:
64 """Replaces an existing alignment with a new alignment."""
65 return re.sub(
66 rb"\(\s*force_align\s*:\s*\d+\s*\)",
67 f"(force_align: {alignment})".encode("utf-8"),
68 line,
69 )
70
71 lines = []
72 for line in schema.splitlines():

Callers 1

_patch_schema_alignmentFunction · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected