API Reference¶
- creyone_layer.wrap.wrap_conv(cls, opt=None)[source]¶
Wrap a Conv Nd class with flexible argument parsing and optional behaviors.
- Parameters:
cls (torch.nn.Conv2d) – A ConvNd-compatible class to wrap.
opt (set | str | None) – A ‘+’-separated string of option flags: - ‘grid’: use the kernel size arg as the stride (grid-like sampling). - ‘ap’: auto-pad so the output spatial size matches the input. - ‘dw’: set groups = in_channels (depthwise convolution).
- Returns:
A factory function that accepts (c1, c2, k, …) positionally or as kwargs and forwards them to
clswith stride, padding, dilation, and groups set.
- creyone_layer.wrap.wrap_pool(cls, opt=None)[source]¶
Wrap a pooling class with flexible argument parsing and optional behaviors.
- Parameters:
cls – A PoolNd-compatible class to wrap. Dilation is forwarded automatically only when the class supports it (MaxPoolNd does, AvgPoolNd does not).
opt (set | str | None) – A ‘+’-separated string of option flags: - ‘grid’: use the kernel size arg as the stride (grid-like sampling). - ‘ap’: auto-pad so the output spatial size matches the input. - ‘ar’: wrap output in AutoReshape for (B HW C) tensors.
- Returns:
A factory function that accepts (k, …) positionally or as kwargs and forwards them to
clswith stride, padding, and dilation set.