Rate this Page

MyST Directives Test Page#

Created On: May 19, 2026 | Last Updated On: May 19, 2026

This page tests all common MyST and sphinx-design directives to verify they render correctly with the PyTorch Sphinx theme.

Admonitions#

Note

This is a note admonition. Use it to highlight important information.

Warning

This is a warning. Proceed with caution when using experimental APIs.

Tip

Use torch.no_grad() context manager to disable gradient computation during inference for better performance.

Important

Always call model.eval() before inference and model.train() before training.

Caution

Mixing CPU and CUDA tensors in operations will raise a RuntimeError.

Danger

Never store sensitive data in model checkpoint files without encryption.

See also

See the PyTorch documentation for more details.

Hint

You can use torch.cuda.is_available() to check for GPU availability.

Custom Titled Admonition#

Custom Title Here

This is an admonition with a custom title styled as a tip.

Tab Sets#

Use Python for most deep learning tasks:

import torch
x = torch.tensor([1.0, 2.0, 3.0])

Use the C++ frontend for production:

#include <torch/torch.h>
auto x = torch::tensor({1.0, 2.0, 3.0});

Use the CLI for quick experiments:

python -m torch.utils.benchmark

Cards#

Standalone Card#

Getting Started with PyTorch

Learn the basics of PyTorch with our beginner tutorials. Covers tensors, autograd, neural networks, and more.

https://pytorch.org/tutorials/

Card Grid#

Training

Learn how to train models with PyTorch.

https://pytorch.org
Deployment

Deploy models to production with TorchServe.

https://pytorch.org

Badges and Buttons#

plain badge primary secondary success warning danger info light dark

Outline Badges#

primary outline warning outline success outline

Buttons#

Go to PyTorch

View Documentation

Definition Lists#

Term 1

Definition of the first term. This can span multiple lines.

Term 2

Definition of the second term.

torch.Tensor

The main data structure in PyTorch. A multi-dimensional matrix containing elements of a single data type.

Field Lists#

Author:

PyTorch Team

Version:

2.0

Status:

Stable

License:

BSD-3

Task Lists#

  • Install PyTorch

  • Set up development environment

  • Train first model

  • Deploy to production

Substitutions#

This project is called PyTorch version 2.0.

Code Blocks#

1import torch
2import torch.nn as nn
3
4model = nn.Linear(10, 5)
5x = torch.randn(3, 10)
6output = model(x)
7print(output.shape)
Installation command#
pip install torch torchvision torchaudio

Math#

\[\nabla_\theta J(\theta) = \mathbb{E}_{\pi_\theta} \left[ \sum_{t=0}^{T} \nabla_\theta \log \pi_\theta(a_t|s_t) \cdot G_t \right]\]

Inline math: \(E = mc^2\)

Tables#

Comparison of Optimizers#

Optimizer

Description

Learning Rate

Momentum

SGD

Stochastic Gradient Descent

0.01

0.9

Adam

Adaptive Moment Estimation

0.001

N/A

AdamW

Adam with weight decay

0.001

N/A

Figures#

PyTorch Logo

The PyTorch logo.#

Block Attributes#

The attrs_block extension lets you attach HTML attributes (classes, IDs) to the next block element using {.classname} or {#id} syntax.

This paragraph is styled with the sd-text-primary class via attrs_block.

This paragraph has a light background, padding, and rounded corners.

Toggles (Nested Dropdowns)#

Outer dropdown

This is the outer content.

Inner dropdown

This is nested inside the outer dropdown.

Sphinx-Design Containers#

Column 1

Content in the first column of a responsive grid.

Column 2

Content in the second column.

Column 3

Content in the third column. On mobile, all columns stack vertically.