- class DVSLayer(input_shape: Tuple[int, int], pool: Tuple[int, int] = (1, 1), crop: Tuple[Tuple[int, int], Tuple[int, int]] | None = None, merge_polarities: bool = False, flip_x: bool = False, flip_y: bool = False, swap_xy: bool = False, disable_pixel_array: bool = True)#
DVSLayer representing the DVS pixel array on chip and/or the pre-processing. The order of processing is as follows MergePolarity -> Pool -> Cut -> Flip
input_shape; – Shape of input (height, width)
pool – Sum pooling kernel size (height, width)
crop – Crop the input to the given ROI ((top, bottom), (left, right))
merge_polarities – If true, events from both polarities will be merged.
flip_x – Flip the X axis
flip_y – Flip the Y axis
swap_xy – Swap X and Y dimensions
disable_pixel_array – Disable the pixel array. This is useful if you want to use the DVS layer for input preprocessing.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- classmethod from_layers(input_shape: Tuple[int, int, int], pool_layer: SumPool2d | None = None, crop_layer: Crop2d | None = None, flip_layer: FlipDims | None = None, disable_pixel_array: bool = True) DVSLayer #
Alternative factory method. Generate a DVSLayer from a set of torch layers
input_shape – (channels, height, width)
pool_layer – SumPool2d layer
crop_layer – Crop2d layer
flip_layer – FlipDims layer
disable_pixel_array – Whether pixel array of new DVSLayer should be disabled.
- get_config_dict() dict #
- get_flip_dict() dict #
Configuration dictionary for x, y flip
- get_output_shape() Tuple[int, int, int] #
Output shape of the layer
(channel, height, width)
- get_output_shape_after_pooling() Tuple[int, int, int] #
Get the shape of data just after the pooling layer.
(channel, height, width)
- get_output_shape_dict() dict #
Configuration dictionary for output shape
- get_pooling() Tuple[int, int] #
Pooling kernel shape
- get_roi() Tuple[Tuple[int, int], Tuple[int, int]] #
The coordinates for ROI. Note that this is not the same as crop parameter passed during the object construction.
((top, bottom), (left, right))
- get_swap_xy() bool #
True if XY has to be swapped.
- property input_shape_dict: dict#
The configuration dictionary for the input shape