Skip to main content

Intel Extension for PyTorch

Project description

Intel® Extension for PyTorch*

Intel® Extension for PyTorch* extends PyTorch with optimizations for extra performance boost on Intel hardware. Most of the optimizations will be included in stock PyTorch releases eventually, and the intention of the extension is to deliver up-to-date features and optimizations for PyTorch on Intel hardware, examples include AVX-512 Vector Neural Network Instructions (AVX512 VNNI) and Intel® Advanced Matrix Extensions (Intel® AMX).

Intel® Extension for PyTorch* is loaded as a Python module for Python programs or linked as a C++ library for C++ programs. Users can enable it dynamically in script by importing intel_extension_for_pytorch. It covers optimizations for both imperative mode and graph mode. Optimized operators and kernels are registered through PyTorch dispatching mechanism. These operators and kernels are accelerated from native vectorization feature and matrix calculation feature of Intel hardware. During execution, Intel® Extension for PyTorch* intercepts invocation of ATen operators, and replace the original ones with these optimized ones. In graph mode, further operator fusions are applied manually by Intel engineers or through a tool named oneDNN Graph to reduce operator/kernel invocation overheads, and thus increase performance.

More detailed tutorials are available at Intel® Extension for PyTorch* online document website.

Installation

You can use either of the following 2 commands to install Intel® Extension for PyTorch*.

python -m pip install intel_extension_for_pytorch
python -m pip install intel_extension_for_pytorch -f https://software.intel.com/ipex-whl-stable

Note: Intel® Extension for PyTorch* has PyTorch version requirement. Please check more detailed information via the URL below.

More installation methods can be found at Installation Guide

Getting Started

Minor code changes are required for users to get start with Intel® Extension for PyTorch*. Both PyTorch imperative mode and TorchScript mode are supported. You just need to import Intel® Extension for PyTorch* package and apply its optimize function against the model object. If it is a training workload, the optimize function also needs to be applied against the optimizer object.

The following code snippet shows an inference code with FP32 data type. More examples, including training and C++ examples, are available at Example page.

import torch
import torchvision.models as models

model = models.resnet50(pretrained=True)
model.eval()
data = torch.rand(1, 3, 224, 224)

import intel_extension_for_pytorch as ipex
model = model.to(memory_format=torch.channels_last)
model = ipex.optimize(model)
data = data.to(memory_format=torch.channels_last)

with torch.no_grad():
  model(data)

Model Zoo

Use cases that had already been optimized by Intel engineers are available at Model Zoo for Intel® Architecture. A bunch of PyTorch use cases for benchmarking are also available on the Github page. You can get performance benefits out-of-box by simply running scipts in the Model Zoo.

License

Apache License, Version 2.0. As found in LICENSE file.

Security

See Intel's Security Center for information on how to report a potential security issue or vulnerability.

See also: Security Policy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

File details

Details for the file intel_extension_for_pytorch-1.11.200-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-1.11.200-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b112f271d560790ce85f2edf1adbd810d9a3cdcc70aed01773889971afc49683
MD5 08b47dcc3b1ef89e3be6a470ad1d6833
BLAKE2b-256 c10f828917d688d176862762da9fbe8928e4a91d419fdedeff697c09979c7ca9

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-1.11.200-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-1.11.200-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 52694c5362565aa7e5843da3f35a4c9b2814341c6bcc172660aa8f7906d0215d
MD5 7eb57f006e383ffe6049d06b0c32b4c3
BLAKE2b-256 f158b292788acd6a007734c9692bd0620fe2e92766627de7a4b9198c4e2b9515

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-1.11.200-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-1.11.200-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e9501ba1f3e7b601dd3473ba78989e7b7dd195cfae3620237e54e2abde4a7be
MD5 571f16ae0fa4ab45cfcce1536c25da55
BLAKE2b-256 3dc32835f34922551149a9d3b23624a510b895b9bd78735482f0f5825a5fd4bd

See more details on using hashes here.

File details

Details for the file intel_extension_for_pytorch-1.11.200-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for intel_extension_for_pytorch-1.11.200-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31d3d275dd1aa504cb9125adf2ef8f38ed72b194c92d49ac3c679092fa4f8f28
MD5 76cf054f5f025a681ff1ffb1b06b21a2
BLAKE2b-256 4346f587530b42f35dcbaf4f5fafc53560569da614fe325220378ecf958378ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page