afe.ir.node

Classes

AwesomeNode

An awesome node is responsible for storing attributes and operations used by the AwesomeNet when

Functions

node_is_sima_ir(→ bool)

Return True is the AwesomeNode contains a SiMa IR

node_is_backend_ir(→ bool)

Return True is the AwesomeNode contains a SiMa IR

node_is_constant(→ bool)

Return True is the AwesomeNode contains a Constant SiMaIR

node_is_placeholder(→ bool)

Return True is the AwesomeNode contains a Placeholder SiMaIR

node_is_awesomenet(→ bool)

Return True is the AwesomeNode contains a AwesomeNet

node_is_external(→ bool)

Return True is the AwesomeNode contains a External Graph

node_is_ev(→ bool)

Return True if the AwesomeNode is an EV node.

node_is_relu(→ bool)

node_is_mean(→ bool)

node_is_upsampling(→ bool)

node_is_subgraph(→ bool)

Return True is the AwesomeNode contains a sub-graph.

node_is_tuple(→ bool)

Return True is the AwesomeNode contains a Tuple.

node_is_tuple_get_item(→ bool)

Return True is the AwesomeNode contains a TupleGetItem.

node_is_unpack(→ bool)

Return True is the AwesomeNode contains an Unpack transform.

node_is_fp32_node(→ bool)

Return True if AwesomeNode's output type is floating point.

node_is_pool_node(→ bool)

Return True if the AwesomeNode contains Pool operator.

node_is_requantization_node(→ bool)

Return True if the AwesomeNode contains Requantize operator.

get_node_inputs(→ Dict[afe.ir.defines.NodeName, Any])

Generates a dictionary using the keys from a node's input_names and the values corresponding

Module Contents

class afe.ir.node.AwesomeNode

An awesome node is responsible for storing attributes and operations used by the AwesomeNet when executing the network

name

Name of the node

input_names

Parameter names of this AwesomeNode. These represent the inputs expected by the code inside this node.

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.

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

_status

Status. Node status. Default is Status.RELAY

_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.

_source_node_names

Source node name from the source model (.onnx, .pt etc.) or source node names if AwesomeNode is a merge composite operator.

name: afe.ir.defines.NodeName
input_names: list[afe.ir.defines.InputName]
input_node_names: list[afe.ir.defines.NodeName]
ir: afe.ir.sima_ir.SiMaIR | afe.ir.net.AwesomeNet | afe.backends.BackendIR
property status: afe.ir.defines.Status
get_type() afe.ir.tensor_type.NodeType
set_batch_size(batch_size: int)

Modifies AwesomeNode’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.

update_layer_stats(layer_stats: afe.ir.defines.LayerStats)
property layer_stats: afe.ir.defines.LayerStats
property source_node_names: list[str] | None
afe.ir.node.node_is_sima_ir(node: AwesomeNode) bool

Return True is the AwesomeNode contains a SiMa IR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_backend_ir(node: AwesomeNode) bool

Return True is the AwesomeNode contains a SiMa IR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_constant(node: AwesomeNode) bool

Return True is the AwesomeNode contains a Constant SiMaIR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_placeholder(node: AwesomeNode) bool

Return True is the AwesomeNode contains a Placeholder SiMaIR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_awesomenet(node: AwesomeNode) bool

Return True is the AwesomeNode contains a AwesomeNet

Parameters:

node – AwesomeNode

afe.ir.node.node_is_external(node: AwesomeNode) bool

Return True is the AwesomeNode contains a External Graph

Parameters:

node – AwesomeNode

afe.ir.node.node_is_ev(node: AwesomeNode) bool

Return True if the AwesomeNode is an EV node.

Parameters:

node – AwesomeNode

afe.ir.node.node_is_relu(node: AwesomeNode) bool
afe.ir.node.node_is_mean(node: AwesomeNode) bool
afe.ir.node.node_is_upsampling(node: AwesomeNode) bool
afe.ir.node.node_is_subgraph(node: AwesomeNode) bool

Return True is the AwesomeNode contains a sub-graph.

Parameters

param node:

AwesomeNode

Return

return:

bool

afe.ir.node.node_is_tuple(node: AwesomeNode) bool

Return True is the AwesomeNode contains a Tuple.

Parameters

param node:

AwesomeNode

Return

return:

bool

afe.ir.node.node_is_tuple_get_item(node: AwesomeNode) bool

Return True is the AwesomeNode contains a TupleGetItem.

Parameters

param node:

AwesomeNode

Return

return:

bool

afe.ir.node.node_is_unpack(node: AwesomeNode) bool

Return True is the AwesomeNode contains an Unpack transform.

Parameters

param node:

AwesomeNode

Return

return:

bool

afe.ir.node.node_is_fp32_node(node: AwesomeNode) bool

Return True if AwesomeNode’s output type is floating point.

Parameters:

node – AwesomeNode to be analyzed.

Returns:

bool. True if AwesomeNode’s output type is fp32, otherwise False.

afe.ir.node.node_is_pool_node(node: AwesomeNode) bool

Return True if the AwesomeNode contains Pool operator.

Parameters:

node – AwesomeNode to be analyzed.

Returns:

bool. True if the AwesomeNode’s operator is Pooling operator (MaxPool, AvgPool).

afe.ir.node.node_is_requantization_node(node: AwesomeNode) bool

Return True if the AwesomeNode contains Requantize operator.

Parameters:

node – AwesomeNode to be analyzed.

Returns:

bool. True if the AwesomeNode’s operator is Requantize operator.

afe.ir.node.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.

Parameters:
  • node – The AwesomeNode we are gathering inputs for.

  • node_outputs – Dictionary containing outputs from other nodes from across the network.

Returns:

A dictionary containing node inputs.