liveBook · Manning

Eager evaluation

As explained in Deep Learning with PyTorch, Second Edition

An execution model in which operations run immediately rather than being first built into a static graph.

Eager evaluation runs operations immediately instead of first assembling them into a static computation graph. In PyTorch, the Python interpreter sends each instruction to the underlying C++ or CUDA implementation as it executes. section 1.5

The execution model makes PyTorch work in a direct, step-by-step way:

  • A PyTorch instruction executes as soon as the interpreter reaches it. section 1.5
  • Operations on tensors are carried out by backend implementations, including C++ or CUDA code. section 1.5
  • The model-development workflow can proceed directly from data loading and training toward deployment or model export. section 1.5

A tensor operation executes immediately

When a Python instruction performs an operation involving a PyTorch tensor, the corresponding computation is carried out at that point by the backend rather than waiting for a separately constructed graph. section 1.5

Figure 1.2 Basic, high-level structure of a PyTorch project, with data loading, training, and deployment to production
figure

A high-level project diagram places immediate tensor computation within the larger flow from data loading and training to production deployment. section 1.5

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Explains execution through the Python interpreter and C++ or CUDA backends, while deferring detailed deployment capabilities to later treatment.
Examples
Uses PyTorch tensor instructions and a project flow spanning data loading, training, model export, and deployment.
What you can do after
Apply it via PyTorch by reasoning about each tensor operation as it executes and by relating computation to deployment choices.
How it connects
Connects PyTorch operations with tensors, Python, C++ and CUDA backends, model export, and production deployment.

Also explained in

Compare how 5 books explain eager evaluation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.