afe.ir.build_node
Functions for building and initializing AwesomeNodes for specific operators. These functions provide a simpler way to create an instance of a chosen operator and initialize all the data structure fields. These functions are not used for transformations on arbitrary operators.
Functions
|
Creates a Tuple AwesomeNode. Used to accommodate AwesomeNet with multiple outputs. |
Creates a TupleGetItem node that is used to split the Tuple output node. |
|
|
Creates a Placeholder AwesomeNode. Each AwesomeNet must have PlaceholderNodes to |
|
Create a quantization node to quantize from float to integer (int8, int16) |
|
Create a dequantization node to dequantize from integer (int8, int16, int32) to float. |
|
Create requantization node that will be used for converting data from int32 to int16 or int8 type. |
|
Create a node that casts tensors from one scalar type to another. |
Module Contents
- afe.ir.build_node.create_tuple_output_node(tuple_inputs: List[afe.ir.node.AwesomeNode], prefix: str) afe.ir.node.AwesomeNode [source]
Creates a Tuple AwesomeNode. Used to accommodate AwesomeNet with multiple outputs.
- Parameters:
tuple_inputs – List of AwesomeNodes that serve as input nodes to resulting Tuple AwesomeNode.
- Returns:
The created Tuple AwesomeNode.
- afe.ir.build_node.create_tuple_get_item_nodes(input_node_name: afe.ir.defines.NodeName, output_types: List[afe.ir.tensor_type.TensorType], prefix: str, input_quant: afe.ir.defines.TupleValue[afe.ir.attributes.QuantResultTensorType] | None = None) List[afe.ir.node.AwesomeNode] [source]
Creates a TupleGetItem node that is used to split the Tuple output node.
- Parameters:
input_node_name – The name of the input Tuple node.
output_types – List of types corresponding to the output types of the Tuple node.
prefix – The prefix string that is prepended to the TupleGetItem node name.
input_quant – Quantization parameters of the input nodes.
- Returns:
The list of TupleGtItem AwesomeNodes.
- afe.ir.build_node.create_placeholder_node(node_name: str, input_type: afe.ir.tensor_type.TensorType) afe.ir.node.AwesomeNode [source]
Creates a Placeholder AwesomeNode. Each AwesomeNet must have PlaceholderNodes to hold the input data.
- Parameters:
node_name – The name of the placeholder node to be created.
input_type – The input type for the placeholder node.
- Returns:
Placeholder node that is created.
- afe.ir.build_node.create_quantization_node(input_name: afe.ir.defines.NodeName, name_counter: int, cast: afe.ir.defines.QuantCast, backend: afe.backends.Backend = Backend.EV) afe.ir.node.AwesomeNode [source]
Create a quantization node to quantize from float to integer (int8, int16)
- Parameters:
input_name – Input node name
name_counter – Node index
cast – Cast to perform quantization
backend – Backend on which node will be executed
- Returns:
AwesomeNode
- afe.ir.build_node.create_dequantization_node(input_name: afe.ir.defines.NodeName, name_counter: int, cast: afe.ir.defines.DequantCast, backend: afe.backends.Backend = Backend.EV) afe.ir.node.AwesomeNode [source]
Create a dequantization node to dequantize from integer (int8, int16, int32) to float.
- Parameters:
input_name – Input node name
name_counter – Node index
cast – Cast to perform dequantization
backend – Backend on which node will be executed
- Returns:
AwesomeNode
- afe.ir.build_node.create_requantization_node(input_name: afe.ir.defines.NodeName, name_counter: int, input_type: afe.ir.tensor_type.TensorType, input_quant: afe.ir.defines.Quantization, output_quant: afe.ir.defines.Quantization, requant_method: afe.ir.defines.RequantMethod, requant: ml_kernels.requantization.BaseRequantization[numpy.ndarray]) afe.ir.node.AwesomeNode [source]
Create requantization node that will be used for converting data from int32 to int16 or int8 type.
- Parameters:
input_name – Input node name
name_counter – Node index
input_type – TensorType of the input tensor
input_quant – Quantization of input tensor
output_quant – Quantization of output tensor
requant_method – Requantization method
requant – Requantization to perform
- Returns:
AwesomeNode
- afe.ir.build_node.create_cast_node(input_name: afe.ir.defines.NodeName, name_counter: int, shape: Tuple[int, Ellipsis], input_type: afe.ir.tensor_type.ScalarType, output_type: afe.ir.tensor_type.ScalarType) afe.ir.node.AwesomeNode [source]
Create a node that casts tensors from one scalar type to another. Casting does not requantize, but only converts the data to a different numeric type.
- Parameters:
input_name – Input of the new cast node
name_counter – Node index
shape – Shape of the input and output
input_type – Scalar type of the input
output_type – Scalar type of the output
- Returns:
AwesomeNode