qonnx.custom_op.general.multithreshold (module)

class qonnx.custom_op.general.multithreshold.MultiThreshold(onnx_node, onnx_opset_version=11)

Bases: qonnx.custom_op.base.CustomOp

Class that corresponds to a multithresholding node.

execute_node(context, graph)

Execute this CustomOp instance, given the execution context and ONNX graph.

get_nodeattr_types()

Returns a dict of permitted attributes for node, where: ret_dict[attribute_name] = (dtype, require, default_value, <allowed_values>) - dtype indicates which member of the ONNX AttributeProto will be utilized - require indicates whether this attribute is required - default_val indicates the default value that will be used if the attribute is not set - <allowed_values> (if specified) indicates that this attribute can only be set to one of the values in the set <allowed_values>. If not specified, all values permitted by dtype are allowed.

infer_node_datatype(model)

Set the DataType annotations corresponding to the outputs of this node.

make_shape_compatible_op(model)

Returns a standard ONNX op which is compatible with this CustomOp for performing shape inference.

verify_node()

Verifies that all attributes the node needs are there and that particular attributes are set correctly. Also checks if the number of inputs is equal to the expected number.

qonnx.custom_op.general.multithreshold.multithreshold(v, thresholds, out_scale=None, out_bias=None)

Given a set of threshold values t={t_0, t_1 … t_n} the successive thresholding maps any real number x to an integer in the interval [0, n], where the returned integer is the number of thresholds x is greater than or equal to.

The output tensor will be scaled by out_scale and biased by out_bias.