finn.custom_op.im2col (module)

class finn.custom_op.im2col.Im2Col(onnx_node)

Bases: finn.custom_op.base.CustomOp

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: returned_dict[attribute_name] = (dtype, require, default_value) - 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

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.

finn.custom_op.im2col.compute_conv_output_dim(ifm_dim, k, stride, pad=0)

Returns spatial output dimension size for convolution with given params.

finn.custom_op.im2col.get_im2col_indices_nchw(x_shape, field_height, field_width, padding=0, stride_y=1, stride_x=1)

Returns im2col indices.

finn.custom_op.im2col.im2col_indices_nchw(x, field_height, field_width, padding=0, stride_y=1, stride_x=1, pad_val=0)

Performs im2col on x with given field height and width, as well as values for padding and stride size. Returns result of im2col.