nir.ir.conv
#
Module Contents#
Classes#
Convolutional layer in 1d. |
|
Convolutional layer in 2d. |
- class nir.ir.conv.Conv1d#
Bases:
nir.ir.node.NIRNode
Convolutional layer in 1d.
Note that the input_shape argument is required to disambiguate the shape, and is used to infer the exact output shape along with the other parameters. If the input_shape is None, the output shape will also be None.
The NIRGraph.infer_all_shapes function may be used to automatically infer the input and output types on the graph level.
- Parameters
input_shape (Optional[int]) – Shape of spatial input (N,)
weight (np.ndarray) – Weight, shape (C_out, C_in, N)
stride (int) – Stride
padding (int | str) – Padding, if string must be ‘same’ or ‘valid’
dilation (int) – Dilation
groups (int) – Groups
bias (np.ndarray) – Bias array of shape (C_out,)
- input_shape: Optional[int]#
- weight: numpy.ndarray#
- stride: int#
- padding: Union[int, str]#
- dilation: int#
- groups: int#
- bias: numpy.ndarray#
- input_type: Optional[Dict[str, numpy.ndarray]]#
- output_type: Optional[Dict[str, numpy.ndarray]]#
- metadata: Dict[str, Any]#
- __post_init__()#
- class nir.ir.conv.Conv2d#
Bases:
nir.ir.node.NIRNode
Convolutional layer in 2d.
Note that the input_shape argument is required to disambiguate the shape, and is used to infer the exact output shape along with the other parameters. If the input_shape is None, the output shape will also be None.
The NIRGraph.infer_all_shapes function may be used to automatically infer the input and output types on the graph level.
- Parameters
input_shape (Optional[tuple[int, int]]) – Shape of spatial input (N_x, N_y)
weight (np.ndarray) – Weight, shape (C_out, C_in, N_x, N_y)
stride (int | int, int) – Stride
padding (int | int, int | str) – Padding, if string must be ‘same’ or ‘valid’
dilation (int | int, int) – Dilation
groups (int) – Groups
bias (np.ndarray) – Bias array of shape (C_out,)
- input_shape: Optional[Tuple[int, int]]#
- weight: numpy.ndarray#
- stride: Union[int, Tuple[int, int]]#
- padding: Union[int, Tuple[int, int], str]#
- dilation: Union[int, Tuple[int, int]]#
- groups: int#
- bias: numpy.ndarray#
- __post_init__()#