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

Method convert_arguments

codegen/api/unboxing.py:60–78  ·  view source on GitHub ↗
(
        self, args: Sequence[Binding]
    )

Source from the content-addressed store, hash-verified

58
59 # Convert all the arguments in a NativeFunction to C++ code
60 def convert_arguments(
61 self, args: Sequence[Binding]
62 ) -> tuple[list[Binding], list[str]]:
63 code_list = [f"EValue& {args[i].name} = *stack[{i}];" for i in range(len(args))]
64 binding_list = []
65 for arg in args:
66 # expecting only Argument
67 if not isinstance(arg.argument, Argument):
68 raise Exception( # noqa: TRY002
69 f"Unexpected argument type, expecting `Argument` but got {arg}"
70 )
71 argument: Argument = arg.argument
72 unboxed_name, _, code, decl = self.argumenttype_evalue_convert(
73 argument.type, argument.name, mutable=argument.is_write
74 )
75 code_list.extend(decl)
76 code_list.extend(code)
77 binding_list.append(arg.with_name(unboxed_name))
78 return binding_list, code_list
79
80 def argumenttype_evalue_convert(
81 self, t: Type, arg_name: str, *, mutable: bool = False

Callers 1

__call__Method · 0.80

Calls 2

appendMethod · 0.45

Tested by

no test coverage detected