dmx.compressor.fx.transformer.export_transformer

Functions

get_nested_attr(obj, attr_path)

Classes

ExportSubstituteTransformer(gm, model[, ...])

class dmx.compressor.fx.transformer.export_transformer.ExportSubstituteTransformer(gm: GraphModule, model: Module, scope: str = '', node_inputs: dict = None)

Bases: Transformer

add_submod(name, mod)

this function will try to reuse modules in old_gm if possible

call_function(target, args, kwargs)

Note

Backwards-compatibility for this API is guaranteed.

call_method(target, args, kwargs)

Execute a call_method node and return the result.

Parameters:
  • target (Target) – The call target for this node. See Node for details on semantics

  • args (Tuple) – Tuple of positional args for this invocation

  • kwargs (Dict) – Dict of keyword arguments for this invocation

Return

Any: The value returned by the method invocation

Note

Backwards-compatibility for this API is guaranteed.

call_module(target, args, kwargs)

Note

Backwards-compatibility for this API is guaranteed.

get_attr(target, args, kwargs)

Execute a get_attr node. In Transformer, this is overridden to insert a new get_attr node into the output graph.

Parameters:
  • target (Target) – The call target for this node. See Node for details on semantics

  • args (Tuple) – Tuple of positional args for this invocation

  • kwargs (Dict) – Dict of keyword arguments for this invocation

Note

Backwards-compatibility for this API is guaranteed.

merge_graph(subgraph, name, args, kwargs)

This function is to merge subgraph to graph

placeholder(target, args, kwargs)

Execute a placeholder node. In Transformer, this is overridden to insert a new placeholder into the output graph.

Parameters:
  • target (Target) – The call target for this node. See Node for details on semantics

  • args (Tuple) – Tuple of positional args for this invocation

  • kwargs (Dict) – Dict of keyword arguments for this invocation

Note

Backwards-compatibility for this API is guaranteed.

dmx.compressor.fx.transformer.export_transformer.get_nested_attr(obj, attr_path)