MyGit

v1.0rc1

pytorch/pytorch

版本发布时间: 2018-10-02 14:28:33

pytorch/pytorch最新发布版本:v2.5.1(2024-10-30 01:58:24)

This is a pre-release preview, do not rely on the tag to have a fixed set of commits, or rely on the tag for anything practical / important

Table of Contents

Highlights

JIT

The JIT is a set of compiler tools for bridging the gap between research in PyTorch and production. It includes a language called Torch Script (don't worry it is a subset of Python, so you'll still be writing Python), and two ways in which you can make your existing code compatible with the JIT. Torch Script code can be aggressively optimized and it can be serialized for later use in our new C++ API, which doesn't depend on Python at all.

# Write in Python, run anywhere!
@torch.jit.script
def RNN(x, h, W_h, U_h, b_h):
  y = []
  for t in range(x.size(0)):
    h = torch.tanh(x[t] @ W_h + h @ U_h + b_h)
    y += [h]
  return torch.stack(y), h

As an example, see a tutorial on deploying a seq2seq model, loading an exported model from C++, or browse the docs.

torch.distributed new "C10D" library

The torch.distributed package and torch.nn.parallel.DistributedDataParallel module are backed by the new "C10D" library. The main highlights of the new library are:

C++ Frontend [API Unstable].

The C++ frontend is a pure C++ interface to the PyTorch backend that follows the API and architecture of the established Python frontend. It is intended to enable research in high performance, low latency and bare metal C++ applications. It provides equivalents to torch.nn, torch.optim, torch.data and other components of the Python frontend. Here is a minimal side-by-side comparison of the two language frontends:

PythonC++
import torch

model = torch.nn.Linear(5, 1) optimizer = torch.optim.SGD(model.parameters(), lr=0.1) prediction = model.forward(torch.randn(3, 5)) loss = torch.nn.functional.mse_loss(prediction, torch.ones(3, 1)) loss.backward() optimizer.step()
#include <torch/torch.h>

torch::nn::Linear model(5, 1); torch::optim::SGD optimizer(model->parameters(), /*lr=*/0.1); torch::Tensor prediction = model->forward(torch::randn({3, 5})); auto loss = torch::mse_loss(prediction, torch::ones({3, 1})); loss.backward(); optimizer.step();

We are releasing the C++ frontend marked as "API Unstable" as part of PyTorch 1.0. This means it is ready to be used for your research application, but still has some open construction sites that will stabilize over the next month or two. Some parts of the API may undergo breaking changes during this time.

See https://pytorch.org/cppdocs for detailed documentation on the greater PyTorch C++ API as well as the C++ frontend.

Breaking Changes

Additional New Features

N-dimensional empty tensors

New Operators

New Distributions

Additions to existing Operators and Distributions

Bug Fixes

Serious

Backwards Compatibility

Correctness

Error checking

Miscellaneous

Other Improvements

Deprecations

CPP Extensions

torch.distributed

Performance

Documentation Improvements

相关地址:原始地址 下载(tar) 下载(zip)

查看:2018-10-02发行的版本