afe.ir.node =========== .. py:module:: afe.ir.node Classes ------- .. autoapisummary:: afe.ir.node.AwesomeNode Functions --------- .. autoapisummary:: afe.ir.node.node_is_sima_ir afe.ir.node.node_is_backend_ir afe.ir.node.node_is_constant afe.ir.node.node_is_placeholder afe.ir.node.node_is_awesomenet afe.ir.node.node_is_external afe.ir.node.node_is_ev afe.ir.node.node_is_relu afe.ir.node.node_is_mean afe.ir.node.node_is_upsampling afe.ir.node.node_is_subgraph afe.ir.node.node_is_tuple afe.ir.node.node_is_tuple_get_item afe.ir.node.node_is_unpack afe.ir.node.node_is_fp32_node afe.ir.node.node_is_pool_node afe.ir.node.node_is_requantization_node afe.ir.node.node_uses_observer afe.ir.node.get_node_inputs Module Contents --------------- .. py:class:: AwesomeNode An awesome node is responsible for storing attributes and operations used by the AwesomeNet when executing the network :param name: Name of the node :param input_names: Parameter names of this AwesomeNode. These represent the inputs expected by the code inside this node. :param input_node_names: Argument names of this AwesomeNode. These represent the inputs supplied by the net that contains this node. Data for each argument gets forwarded to the corresponding parameter. :param ir: Union[SiMaIR, "afe.ir.net.AwesomeNet", "afe.backends.BackendIR"]. The IR can be: * SiMaIR - A frontend IR that contains single operation or ExternalOp * AwesomeNet - A frontend IR that contains a sub-graph that can be supported by SiMa's backends * BackendIR - A backend IR that can be compiled, or already compiled by certain backend :param _status: Status. Node status. Default is Status.RELAY :param _layer_stats: Layer statistics. For each MLA node, quantization error is calculated, that information is than forwarded to .sima.json file, and it can be viewed in Netron. .. py:attribute:: name :type: afe.ir.defines.NodeName .. py:attribute:: input_names :type: List[afe.ir.defines.InputName] .. py:attribute:: input_node_names :type: List[afe.ir.defines.NodeName] .. py:attribute:: ir :type: Union[afe.ir.sima_ir.SiMaIR, afe.ir.net.AwesomeNet, afe.backends.BackendIR] .. py:property:: status :type: afe.ir.defines.Status .. py:method:: get_type() -> afe.ir.tensor_type.NodeType .. py:method:: set_batch_size(batch_size: int) Modifies AwesomeNode's internal parameters to accommodate for a given batch size. :param batch_size: Integer value representing the batch size of the inputs to the AwesomeNet. .. py:method:: update_layer_stats(layer_stats: afe.ir.defines.LayerStats) .. py:property:: layer_stats :type: afe.ir.defines.LayerStats .. py:function:: node_is_sima_ir(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a SiMa IR :param node: AwesomeNode .. py:function:: node_is_backend_ir(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a SiMa IR :param node: AwesomeNode .. py:function:: node_is_constant(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a Constant SiMaIR :param node: AwesomeNode .. py:function:: node_is_placeholder(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a Placeholder SiMaIR :param node: AwesomeNode .. py:function:: node_is_awesomenet(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a AwesomeNet :param node: AwesomeNode .. py:function:: node_is_external(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a External Graph :param node: AwesomeNode .. py:function:: node_is_ev(node: AwesomeNode) -> bool Return True if the AwesomeNode is an EV node. :param node: AwesomeNode .. py:function:: node_is_relu(node: AwesomeNode) -> bool .. py:function:: node_is_mean(node: AwesomeNode) -> bool .. py:function:: node_is_upsampling(node: AwesomeNode) -> bool .. py:function:: node_is_subgraph(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a sub-graph. Parameters ---------- :param node: AwesomeNode Return ------ :return: bool .. py:function:: node_is_tuple(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a Tuple. Parameters ---------- :param node: AwesomeNode Return ------ :return: bool .. py:function:: node_is_tuple_get_item(node: AwesomeNode) -> bool Return True is the AwesomeNode contains a TupleGetItem. Parameters ---------- :param node: AwesomeNode Return ------ :return: bool .. py:function:: node_is_unpack(node: AwesomeNode) -> bool Return True is the AwesomeNode contains an Unpack transform. Parameters ---------- :param node: AwesomeNode Return ------ :return: bool .. py:function:: node_is_fp32_node(node: AwesomeNode) -> bool Return True if AwesomeNode's output type is floating point. :param node: AwesomeNode to be analyzed. :return: bool. True if AwesomeNode's output type is fp32, otherwise False. .. py:function:: node_is_pool_node(node: AwesomeNode) -> bool Return True if the AwesomeNode contains Pool operator. :param node: AwesomeNode to be analyzed. :return: bool. True if the AwesomeNode's operator is Pooling operator (MaxPool, AvgPool). .. py:function:: node_is_requantization_node(node: AwesomeNode) -> bool Return True if the AwesomeNode contains Requantize operator. :param node: AwesomeNode to be analyzed. :return: bool. True if the AwesomeNode's operator is Requantize operator. .. py:function:: node_uses_observer(node: AwesomeNode) -> bool Return True if node uses calibration information during quantization. :param node: AwesomeNode to be analyzed. :return: bool. True if AwesomeNode uses calibration information during quantization. Otherwise, quantization information is obtained using quantization from its input node(s). .. py:function:: get_node_inputs(node: AwesomeNode, node_outputs: Dict[afe.ir.defines.NodeName, Any]) -> Dict[afe.ir.defines.NodeName, Any] Generates a dictionary using the keys from a node's input_names and the values corresponding to the data of nodes whose names are in the node's input_node_names. :param node: The AwesomeNode we are gathering inputs for. :param node_outputs: Dictionary containing outputs from other nodes from across the network. :return: A dictionary containing node inputs.