Skip to main content
Article·pytorch.org
machine-learningdeep-learningneural-networkspythonpytorchtensors

PyTorch

Get started with PyTorch by setting up your environment, creating tensors, and building a simple neural network.

beginner30 minutes4 steps
The play
  1. Environment Setup
    Install PyTorch using pip. Choose the appropriate configuration based on your operating system and CUDA availability.
  2. Creating Tensors
    Create a basic PyTorch tensor. Tensors are the fundamental data structure in PyTorch, similar to NumPy arrays.
  3. Building a Simple Neural Network
    Define a simple neural network with one linear layer. This network takes an input of size 3 and outputs a single value.
  4. Forward Pass
    Perform a forward pass through the network with a sample input tensor.
Starter code
Start by installing PyTorch and verifying the installation by creating a simple tensor.
Source
PyTorch — Action Pack