Files
Svetlana Karslioglu 19da3da3d3 Restructure C++ docs (#174096)
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
2026-04-07 17:24:38 +00:00

1.7 KiB

myst
myst
html_meta
description keywords
Dropout layers in PyTorch C++ — Dropout, Dropout2d, Dropout3d, AlphaDropout, and FeatureAlphaDropout. PyTorch, C++, Dropout, Dropout2d, Dropout3d, AlphaDropout, regularization

Dropout Layers

Dropout randomly zeros elements during training as a regularization technique, preventing overfitting by forcing the network to learn redundant representations. During evaluation, dropout is disabled and outputs are scaled appropriately.

  • Dropout: Standard dropout for fully-connected layers
  • Dropout2d/3d: Spatial dropout that zeros entire channels (better for CNNs)
  • AlphaDropout: Maintains self-normalizing property (use with SELU activation)

Remember to call `model->train()` during training and `model->eval()` during
inference to properly enable/disable dropout behavior.

Dropout

:members:
:undoc-members:
:members:
:undoc-members:

Example:

auto dropout = torch::nn::Dropout(torch::nn::DropoutOptions(0.5));

Dropout2d / Dropout3d

:members:
:undoc-members:
:members:
:undoc-members:
:members:
:undoc-members:
:members:
:undoc-members:

AlphaDropout

:members:
:undoc-members:
:members:
:undoc-members:

FeatureAlphaDropout

:members:
:undoc-members:
:members:
:undoc-members: