(builder, node, err, add_op_function)
Splits list of input into chain of operator with two inputs
    where output of first node is fed into next one until the final input
    is processed
    Pass node:            Node to be converted
         add_op_function: Conversion function to be used
Splits list of input into chain of operator with two inputs
    where output of first node is fed into next one until the final input
    is processed
    Pass node:            Node to be converted
         add_op_function: Conversion function to be used
Splits list of input into chain of operator with two inputs where output of first node is fed into next one until the final input is processed Pass node : Node to be converted add_op_function : Conversion function to be used
def add_broadcastable_op_chain(builder, node, err, add_op_function):
    '''
    Splits list of input into chain of operator with two inputs
    where output of first node is fed into next one until the final input
    is processed
    Pass node:            Node to be converted
         add_op_function: Conversion function to be used
    '''
    total_nodes = len(node.inputs)
    
    if total_nodes < 2:
        # TODO: Skip or CopyProp + DeadCode elimination
        builder.add_activation(
            name=node.name,
            non_linearity = 'LINEAR',
            input_name=node.inputs[0],
            output_name=node.outputs[0],
            params=[1.0, 0.0]
        )
    elif total_nodes == 2:
        add_op_function(
            name=node.name,
            input_names=node.inputs,
            output_name=node.outputs[0]
        )
    else:
        decorator = 0
        out_name = node.outputs[0]
        # Add broadcastable layer for first two inputs
        add_op_function(
            name=node.name,
            input_names=[node.inputs[0], node.inputs[1]],
            output_name=out_name+'_'+str(decorator)
        )
        # Continue chain of broadcastable layers
        for i in range(2, total_nodes-1):
            add_op_function(
                name=node.name,
                input_names=[out_name+'_'+str(decorator), node.inputs[i]],
                output_name=out_name+'_'+str(decorator+1)
            )
            decorator += 1
        # End chain of broadcastable layers with final output
        add_op_function(
            name=node.name+'_'+str(decorator),
            input_names=[out_name+'_'+str(decorator), node.inputs[total_nodes-1]],
            output_name=out_name
        )
def add_broadcastable_op_chain ( builder , node , err , add_op_function ) : total_nodes = len ( node . inputs ) if total_nodes < 2 : # TODO: Skip or CopyProp + DeadCode elimination builder . add_activation ( name = node . name , non_linearity = 'LINEAR' , input_name = node . inputs [ 0 ] , output_name = node . outputs [ 0 ] , params = [ 1.0 , 0.0 ] ) elif total_nodes == 2 : add_op_function ( name = node . name , input_names = node . inputs , output_name = node . outputs [ 0 ] ) else : decorator = 0 out_name = node . outputs [ 0 ] # Add broadcastable layer for first two inputs add_op_function ( name = node . name , input_names = [ node . inputs [ 0 ] , node . inputs [ 1 ] ] , output_name = out_name + '_' + str ( decorator ) ) # Continue chain of broadcastable layers for i in range ( 2 , total_nodes - 1 ) : add_op_function ( name = node . name , input_names = [ out_name + '_' + str ( decorator ) , node . inputs [ i ] ] , output_name = out_name + '_' + str ( decorator + 1 ) ) decorator += 1 # End chain of broadcastable layers with final output add_op_function ( name = node . name + '_' + str ( decorator ) , input_names = [ out_name + '_' + str ( decorator ) , node . inputs [ total_nodes - 1 ] ] , output_name = out_name )