afe.ir.build_node ================= .. py:module:: afe.ir.build_node .. autoapi-nested-parse:: 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 --------- .. autoapisummary:: afe.ir.build_node.create_tuple_output_node afe.ir.build_node.create_tuple_get_item_nodes afe.ir.build_node.create_placeholder_node afe.ir.build_node.create_quantization_node afe.ir.build_node.create_dequantization_node afe.ir.build_node.create_requantization_node afe.ir.build_node.create_cast_node Module Contents --------------- .. py:function:: create_tuple_output_node(tuple_inputs: List[afe.ir.node.AwesomeNode], prefix: str) -> afe.ir.node.AwesomeNode Creates a Tuple AwesomeNode. Used to accommodate AwesomeNet with multiple outputs. :param tuple_inputs: List of AwesomeNodes that serve as input nodes to resulting Tuple AwesomeNode. :return: The created Tuple AwesomeNode. .. py:function:: create_tuple_get_item_nodes(input_node_name: afe.ir.defines.NodeName, output_types: List[afe.ir.tensor_type.TensorType], prefix: str, input_quant: Optional[afe.ir.defines.TupleValue[afe.ir.attributes.QuantResultTensorType]] = None) -> List[afe.ir.node.AwesomeNode] Creates a TupleGetItem node that is used to split the Tuple output node. :param input_node_name: The name of the input Tuple node. :param output_types: List of types corresponding to the output types of the Tuple node. :param prefix: The prefix string that is prepended to the TupleGetItem node name. :param input_quant: Quantization parameters of the input nodes. :return: The list of TupleGtItem AwesomeNodes. .. py:function:: create_placeholder_node(node_name: str, input_type: afe.ir.tensor_type.TensorType) -> afe.ir.node.AwesomeNode Creates a Placeholder AwesomeNode. Each AwesomeNet must have PlaceholderNodes to hold the input data. :param node_name: The name of the placeholder node to be created. :param input_type: The input type for the placeholder node. :return: Placeholder node that is created. .. py:function:: 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 Create a quantization node to quantize from float to integer (int8, int16) :param input_name: Input node name :param name_counter: Node index :param cast: Cast to perform quantization :param backend: Backend on which node will be executed :return: AwesomeNode .. py:function:: 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 Create a dequantization node to dequantize from integer (int8, int16, int32) to float. :param input_name: Input node name :param name_counter: Node index :param cast: Cast to perform dequantization :param backend: Backend on which node will be executed :return: AwesomeNode .. py:function:: 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 Create requantization node that will be used for converting data from int32 to int16 or int8 type. :param input_name: Input node name :param name_counter: Node index :param input_type: TensorType of the input tensor :param input_quant: Quantization of input tensor :param output_quant: Quantization of output tensor :param requant_method: Requantization method :param requant: Requantization to perform :return: AwesomeNode .. py:function:: 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 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. :param input_name: Input of the new cast node :param name_counter: Node index :param shape: Shape of the input and output :param input_type: Scalar type of the input :param output_type: Scalar type of the output :return: AwesomeNode