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.

node_uses_observer(→ bool)

Return True if node uses calibration information during quantization.

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[source]

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

Parameters:
  • 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.

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

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)[source]
property layer_stats: afe.ir.defines.LayerStats[source]
afe.ir.node.node_is_sima_ir(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a SiMa IR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_backend_ir(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a SiMa IR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_constant(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a Constant SiMaIR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_placeholder(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a Placeholder SiMaIR

Parameters:

node – AwesomeNode

afe.ir.node.node_is_awesomenet(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a AwesomeNet

Parameters:

node – AwesomeNode

afe.ir.node.node_is_external(node: AwesomeNode) bool[source]

Return True is the AwesomeNode contains a External Graph

Parameters:

node – AwesomeNode

afe.ir.node.node_is_ev(node: AwesomeNode) bool[source]

Return True if the AwesomeNode is an EV node.

Parameters:

node – AwesomeNode

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

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[source]

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[source]

Return True is the AwesomeNode contains a TupleGetItem.

Parameters

param node:

AwesomeNode

Return

return:

bool

afe.ir.node.node_is_unpack(node: AwesomeNode) bool[source]

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[source]

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[source]

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[source]

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.node_uses_observer(node: AwesomeNode) bool[source]

Return True if node uses calibration information during quantization.

Parameters:

node – AwesomeNode to be analyzed.

Returns:

bool. True if AwesomeNode uses calibration information during quantization. Otherwise, quantization information is obtained using quantization from its input node(s).

afe.ir.node.get_node_inputs(node: AwesomeNode, node_outputs: Dict[afe.ir.defines.NodeName, Any]) Dict[afe.ir.defines.NodeName, Any][source]

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.