liveBook · Manning

PyTorch

As explained in Learn Generative AI with PyTorch

A deep learning library used here for building and training neural networks, especially with dynamic computation graphs and GPU acceleration.

PyTorch is an open-source Python library for building and training deep learning models. It is used here to build generative models from scratch, with classification tasks providing a practical starting point. Compared with TensorFlow, its appeal is ease of use and flexibility. section 1.1.3 section 2.0

A computational graph tracks operations and the data flowing between them. PyTorch creates and changes this graph as a model runs, which helps with varying architectures and debugging. The graph supports the gradient calculations needed to update model parameters. GPU training can also reduce training time compared with CPU training. section 1.1.3

Classify clothing images

Start with labeled grayscale clothing images and convert their raw pixels into floating-point PyTorch tensors. Build a network with dense layers to predict one of ten clothing types. Use cross-entropy loss to measure predictions against labels, then use the Adam optimizer with a learning rate of 0.001 to update the weights. Keep a validation set to assess the model and help choose training settings. section 2.2 section 2.2.1

The same training foundations carry into generative work: a GAN discriminator makes a binary real-or-fake classification, while text generation can require predicting the next character or word from many possibilities. section 2.0

How Learn Generative AI with PyTorch covers it

How deep it goes
Explains dynamic graphs and GPU training, then outlines a tensor-to-validation workflow without giving low-level graph internals.
Examples
Works through labeled grayscale clothing images, a dense network, cross-entropy loss, Adam, and a validation set.
What it assumes
Assumes foundational machine learning and neural-network knowledge while refreshing loss functions, activation functions, optimizers, and learning rates.
What you can do after
Build it from scratch: train a PyTorch clothing-image classifier and use validation data to assess training choices.
How it connects
Connects PyTorch to computational graphs, backpropagation, gradient descent, tensors, GANs, and multicategory classification.

Also explained in

Compare how 11 books explain PyTorch →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Generative AI with PyTorch. The section links point to the parts of the book it draws on.