afe.backends.mpk.node

Functions for making MPK JSON node descriptions.

Functions

flatten_tuple(β†’Β List[_A])

Convert un-nested tuples to a list.

get_node_size(β†’Β int)

Get node size in bytes.

get_output_node_names(β†’Β afe.ir.defines.DataValue[str])

Get the output node names.

get_plugin_input_nodes(...)

Convert a list of MPK JSON nodes to a list of inputs for MLA or EV74 plugin.

Module Contents

afe.backends.mpk.node.flatten_tuple(data: afe.ir.defines.DataValue[_A]) List[_A][source]

Convert un-nested tuples to a list. Given a tuple of 0, 2, or more tensors, the tuple elements are returned. Given a tensor, the tensor is returned as a list of 1 item. An exception is raised for other inputs.

Parameters:

data – Data value

Returns:

Flattened data value

afe.backends.mpk.node.get_node_size(node: afe.ir.node.AwesomeNode) int[source]

Get node size in bytes.

Parameters:

node – AwesomeNode

Returns:

Number of bytes.

afe.backends.mpk.node.get_output_node_names(node_name: str, output_type: afe.ir.defines.DataValue[afe.ir.tensor_type.TensorType], output_names: Dict[str, str]) afe.ir.defines.DataValue[str][source]

Get the output node names. Check if output node is an output of the model and if it is original model name is added to the ModelSDK name.

afe.backends.mpk.node.get_plugin_input_nodes(input_nodes: List[afe.backends.mpk.defines.InOutNodesMPKData]) List[afe.backends.mpk.defines.PluginInputNodeMPKData][source]

Convert a list of MPK JSON nodes to a list of inputs for MLA or EV74 plugin.

Parameters:

input_node – MPK JSON objects representing inputs to the AwesomeNode.

Returns:

PluginInputNodeMPKData class with input node.