mirror of
https://github.com/pytorch/pytorch.git
synced 2026-10-28 18:56:51 +08:00
The fix-cpp-build branch is a major restructuring that: - Drops Exhale (which auto-generated API docs but caused OOM in CI) in favor of hand-written RST pages using Breathe directives - Reorganizes notes into a hierarchical API reference with proper categories - Adds new content: XPU docs, stable ABI docs, DeviceGuard/Stream docs - Always runs Doxygen instead of gating on an env var Pull Request resolved: https://github.com/pytorch/pytorch/pull/174096 Approved by: https://github.com/janeyx99, https://github.com/seemethere, https://github.com/albanD
3.0 KiB
3.0 KiB
myst
| myst | ||||||
|---|---|---|---|---|---|---|
|
Convolution Layers
Convolutional layers apply learnable filters to input data, extracting local features through sliding window operations. They are fundamental to CNNs for image, audio, and sequential data processing.
- Conv1d/2d/3d: Standard convolution for 1D sequences, 2D images, or 3D volumes
- ConvTranspose1d/2d/3d: Transposed convolution (deconvolution) for upsampling
Key parameters:
in_channels: Number of input channelsout_channels: Number of output channels (number of filters)kernel_size: Size of the convolving kernelstride: Stride of the convolution (default: 1)padding: Zero-padding added to input (default: 0)dilation: Spacing between kernel elements (default: 1)groups: Number of blocked connections (default: 1, usein_channelsfor depthwise)
Conv1d
Applies 1D convolution over an input signal composed of several input planes.
:members:
:undoc-members:
:members:
:undoc-members:
Conv2d
Applies 2D convolution over an input image. The most commonly used layer for image processing tasks.
:members:
:undoc-members:
:members:
:undoc-members:
Example:
// Create Conv2d: 3 input channels, 64 output channels, 3x3 kernel
auto conv = torch::nn::Conv2d(
torch::nn::Conv2dOptions(3, 64, 3)
.stride(1)
.padding(1)
.bias(true));
auto output = conv->forward(input); // input: [N, 3, H, W]
Conv3d
Applies 3D convolution over an input volume (e.g., video frames or 3D medical images).
:members:
:undoc-members:
:members:
:undoc-members:
ConvTranspose1d
Applies 1D transposed convolution (fractionally-strided convolution) for upsampling.
:members:
:undoc-members:
:members:
:undoc-members:
ConvTranspose2d
Applies 2D transposed convolution for upsampling. Commonly used in decoder networks and generative models.
:members:
:undoc-members:
:members:
:undoc-members:
Example:
// Create ConvTranspose2d for upsampling
auto conv_transpose = torch::nn::ConvTranspose2d(
torch::nn::ConvTranspose2dOptions(64, 32, 4)
.stride(2)
.padding(1));
ConvTranspose3d
Applies 3D transposed convolution for upsampling volumetric data.
:members:
:undoc-members:
:members:
:undoc-members: