dmx.compressor.fx.transformer.configuration_transformer
Classes
|
A transformer that changes the format of the ops according to the cfg file |
- class dmx.compressor.fx.transformer.configuration_transformer.ConfigurationTransformer(module: GraphModule, scopeDict: dict, cfg=None)
Bases:
TransformerA transformer that changes the format of the ops according to the cfg file
- Parameters:
module (fx.GraphModule) – module to be added with additional ops.
scopeDict (Optional[dict]) – Dictionary that maps node name to scope. Defaults to None.
cfg (Optional[str]) – config file for setting the added ops formats. Defaults to None.
- module
module to be added with additional ops.
- Type:
fx.GraphModule
- scopeDict
Dictionary that maps node name to scope.
- Type:
Optional[str]
- cfg
config file for setting the added ops formats.
- Type:
Optional[str]
- call_function(target: Target, args: Tuple[tuple[Argument, ...] | Sequence[Argument] | Mapping[str, Argument] | slice | range | Node | str | int | float | bool | complex | dtype | Tensor | device | memory_format | layout | OpOverload | SymInt | SymBool | SymFloat | None, ...], kwargs: Dict[str, Any]) Any
Execute a
call_functionnode. Modifies the format of cast according to cfg- 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
- Returns:
A Proxy containing the node and the tracer of the new graph
- get_attr(target: Target, args: Tuple[tuple[Argument, ...] | Sequence[Argument] | Mapping[str, Argument] | slice | range | Node | str | int | float | bool | complex | dtype | Tensor | device | memory_format | layout | OpOverload | SymInt | SymBool | SymFloat | None, ...], kwargs: Dict[str, Any]) Proxy
Execute a
get_attrnode. Modifies the format of cast/sparsifier according to cfg- 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
- Returns:
A Proxy containing the node and the tracer of the new graph
- has_module(target: str) bool
A function that checks if self.module contains a specific target
- Parameters:
target (str) – the target to look up
- Returns:
True if self.module contains a node with the same target
- output(target: Target, args: Tuple[tuple[Argument, ...] | Sequence[Argument] | Mapping[str, Argument] | slice | range | Node | str | int | float | bool | complex | dtype | Tensor | device | memory_format | layout | OpOverload | SymInt | SymBool | SymFloat | None, ...], kwargs: Dict[str, Any]) Any
Execute a
outputnode. Modifies the format of output_cast according to cfg- 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
- Returns:
A Proxy containing the node and the tracer of the new graph
- placeholder(target: Target, args: Tuple[tuple[Argument, ...] | Sequence[Argument] | Mapping[str, Argument] | slice | range | Node | str | int | float | bool | complex | dtype | Tensor | device | memory_format | layout | OpOverload | SymInt | SymBool | SymFloat | None, ...], kwargs: Dict[str, Any]) Proxy
Execute a
placeholdernode. Modifies the format of input_cast according to cfg- 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
- Returns:
A Proxy containing the node and the tracer of the new graph
- transform()
Transform
self.moduleand return the transformed``GraphModule``.- Returns:
A GraphModule with updated ops formats.