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

Function create_kernel_key

codegen/tools/gen_oplist.py:198–212  ·  view source on GitHub ↗
(maybe_kernel_key: str)

Source from the content-addressed store, hash-verified

196
197
198def create_kernel_key(maybe_kernel_key: str) -> str:
199 # It is a kernel key.
200 if maybe_kernel_key.lstrip().startswith("v1"):
201 return maybe_kernel_key
202 # It is a dtype.
203 else:
204 # Generate a kernel key based on the dtype provided.
205 # Note: no dim order is included in this kernel key.
206 # For a description of the kernel key format, see
207 # executorch/blob/main/runtime/kernel/operator_registry.h#L97-L123
208 try:
209 dtype = ScalarType[maybe_kernel_key]
210 return "v1/" + str(dtype.value) + ";"
211 except KeyError:
212 raise Exception(f"Unknown dtype: {maybe_kernel_key}")
213
214
215def gen_oplist(

Callers 1

gen_oplistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected