Skip to content
.NET bindings for PyTorch. Machine Learning with C# / F# with Multi-GPU/CPU support
C# Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
libs build instruction May 14, 2019
test/Torch.UnitTest added torch.nn.functional namespace Jul 10, 2019
.gitignore pythonnet test May 15, 2019
LICENSE Update Aug 11, 2019
Torch.NET.sln Added a simple Neural Network example Jul 8, 2019


Torch.NET brings the awesome PyTorch library to the .NET world. It offers Tensor computations and Neural Network modules with efficient GPU or multi-core CPU processing support and is to be considered one of the fundamental libraries for scientific computing, machine learning and AI. Torch.NET empowers .NET developers to leverage PyTorch's extensive functionality including computational graphs with with multi-dimensional arrays, back-propagation, neural network implementations and many more via a compatible strong-typed API.

Check out this example fitting a two-layer neural network against random data in C# and Python:



You need Python 3.7 and PyTorch installed on your System for Torch.NET to work.


Torch.NET is currently under very busy construction. The entire torch.* API has been completed. If you execute the unit tests you'll see that tensors can be created on CPU and GPU and operations can be performed on them.


The checked categories have been wrapped.

  • torch
  • torch.Tensor
  • Tensor Attributes
  • Type Info
  • torch.sparse
  • torch.cuda
  • torch.Storage
  • torch.nn
  • torch.nn.functional
  • torch.nn.init
  • torch.optim
  • torch.autograd
  • torch.distributed
  • torch.distributions
  • torch.hub
  • torch.jit
  • torch.multiprocessing
  • torch.utils.bottleneck
  • torch.utils.checkpoint
  • torch.utils.cpp_extension
  • torch.utils.dlpack
  • torch.utils.model_zoo
  • torch.utils.tensorboard (experimental)
  • torch.onnx
  • torch.config


Torch.NET 1.0.0 on

You can’t perform that action at this time.