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

Function escape

backends/vulkan/runtime/gen_vulkan_spv.py:570–581  ·  view source on GitHub ↗
(line: str)

Source from the content-addressed store, hash-verified

568
569# https://github.com/google/XNNPACK/blob/master/tools/xngen.py
570def escape(line: str) -> str:
571 output_parts = []
572 while "${" in line:
573 start_pos = line.index("${")
574 end_pos = line.index("}", start_pos + 2)
575 if start_pos != 0:
576 output_parts.append('"' + line[:start_pos].replace('"', '\\"') + '"')
577 output_parts.append("str(" + line[start_pos + 2 : end_pos] + ")")
578 line = line[end_pos + 1 :]
579 if line:
580 output_parts.append('"' + line.replace('"', '\\"') + '"')
581 return " + ".join(output_parts)
582
583
584# https://github.com/google/XNNPACK/blob/master/tools/xngen.py

Callers 1

preprocessFunction · 0.85

Calls 2

indexMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected