tvm_tirx.script.ir_builder.resolve_global_info_args

tvm_tirx.script.ir_builder.resolve_global_info_args#

tvm_tirx.script.ir_builder.resolve_global_info_args(*fields, resolver)#

Resolve selected string arguments before calling a builder operation.

Parameters:
  • *fields (str) – Names of positional-only, positional-or-keyword, or keyword-only parameters. Repeated names are resolved once. Omitted arguments use their declared defaults.

  • resolver (Callable[[str], Any]) – Explicit callback receiving each selected string and returning its replacement. The callback owns selector syntax, lookup scope, and errors. Non-string values pass through with their identity preserved; containers are not decoded recursively.

Returns:

Callable – Decorator preserving the callable’s signature, name, and documentation. The signature is inspected once when decorating, then reused for argument binding.

Raises:

ValueError – If a selected name is absent or names a variadic parameter.

Return type:

Callable[[Callable[[…], Any]], Callable[[…], Any]]

Notes

All argument expressions are evaluated once in ordinary Python order before binding, resolution, and the callable body. Positional, keyword, unpacked, and aliased calls share this behavior. Selected string defaults are resolved on every call. Exceptions from binding, the resolver, and the callable propagate unchanged.

@resolve_global_info_args("device", resolver=lookup_device)
def tensor(shape, device="default"):
    return make_tensor(shape, device)