afe.ir.sima_ir

Attributes

SiMaIRTensorTypes

SiMaIRInputTypes

NODE_DICT_OPERATORS

NODE_DICT_SPECIAL

NODE_DICT

ATTRS_NAME_DICT

Classes

SiMaIRMetadata

dict() -> new empty dictionary

SiMaIR

SiMaIRParamsDict

Module Contents

afe.ir.sima_ir.SiMaIRTensorTypes[source]
afe.ir.sima_ir.SiMaIRInputTypes[source]
class afe.ir.sima_ir.SiMaIRMetadata(relay_ir_name: str)[source]

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

class afe.ir.sima_ir.SiMaIR[source]
Parameters:
  • operation – Contains the node’s functions

  • _attrs – Floating-point operator attributes. If the operator is quantized, it should be None.

  • calib_attrs – Calibration attributes

  • _quant_attrs – Quantized operator attributes. If the operator is not quantized, it should be None.

  • quant_config – Parameters that influence how the operator is quantized. This field is immutable.

  • backend – If this node is assigned to a backend by itself (not counting being part of a subgraph assigned to a backend), this is the assigned backend. Otherwise, this is Backend.NONE.

operation: afe.ir.operations.AwesomeOperation[source]
calib_attrs: afe.ir.attributes.AwesomeCalibAttrs[source]
quant_config: afe.core.configs.QuantizationConfigs[source]
backend: afe.backends.Backend[source]
property attrs: afe.ir.attributes.AwesomeAttributes | None[source]
get_attrs() afe.ir.attributes.AwesomeAttributes | afe.ir.attributes.AwesomeQuantAttrBase[source]
property quant_attrs: afe.ir.attributes.AwesomeQuantAttrBase | None[source]
should_bypass_input_to_output()[source]

Whether the SiMaIR bypasses the input to the output.

get_type() afe.ir.tensor_type.NodeType[source]

Get the type of this node.

run(inputs: SiMaIRInputTypes, config: afe.core.configs.RunConfigs)[source]
calibrate(inputs: SiMaIRInputTypes, config: afe.core.configs.RunConfigs)[source]
quantize(inputs: Dict[afe.ir.defines.InputName, afe.ir.operations.QuantizationTensorData], placeholder_value: afe.ir.operations.QuantizationTensorData | None, quantize_attributes: bool, error_reporter: afe.ir.defines.NodeReporter | None = None) Tuple[afe.ir.operations.QuantizationTensorData, afe.ir.defines.InputsQuantCast][source]

Select quantization scales of input and output tensors, and quantize this operation.

The input and output attributes are planned to be removed, and they should not be used in new code.

Parameters:
  • inputs – Properties of the inputs. It has quantization scales of the input tensors and attributes of the nodes that calculate the inputs.

  • placeholder_value – If the node being quantized is a placeholder node, the properties of the placeholder’s input data. None otherwise.

  • quantize_attributes – If True, the operation will be quantized. If False, the operation will not be quantized. Either way, quantization scales will be selected.

  • error_reporter – Node reporter of the node to be quantized.

Returns:

Properties of the node’s output and casts that should be applied to the node’s input. It has quantization scales of the output and attributes of this node.

run_quant(inputs: SiMaIRInputTypes, config: afe.core.configs.RunConfigs)[source]
set_batch_size(batch_size: int)[source]

Modifies SiMaIR’s internal parameters to accommodate for a given batch size.

Parameters:

batch_size – Integer value representing the batch size of the inputs to the AwesomeNet.

class afe.ir.sima_ir.SiMaIRParamsDict[source]
attrs: Type[afe.ir.attributes.AwesomeAttributes][source]
quant_attrs: Type[afe.ir.attributes.AwesomeQuantAttrBase][source]
operation: afe.ir.operations.AwesomeOperation[source]
afe.ir.sima_ir.NODE_DICT_OPERATORS: Dict[str, SiMaIRParamsDict][source]
afe.ir.sima_ir.NODE_DICT_SPECIAL: Dict[str, SiMaIRParamsDict][source]
afe.ir.sima_ir.NODE_DICT: Dict[str, SiMaIRParamsDict][source]
afe.ir.sima_ir.ATTRS_NAME_DICT: Dict[str, Type[afe.ir.attributes.AwesomeAttributes]][source]