Wikiprompt

Torch Release

Torch is an open-source machine learning library and scientific computing framework based on Lua, created by Idiap Research Institute. It provides LuaJIT interfaces to deep learning algorithms and was the precursor to PyTorch.

Torch is an open-source machine learning library, scientific computing framework, and scripting language based on Lua. It provides LuaJIT interfaces to deep learning algorithms implemented in C. The library was created by the Idiap Research Institute and later ported to Python as PyTorch in 2017, at which point active development shifted to the Python version. Torch offers a flexible set of tools for building and training neural networks, including tensors, neural network modules, and optimization utilities. Its design influenced subsequent deep learning frameworks and contributed to the broader field of [[deep-learning|deep learning] and [[machine-learning]m]achine learning] as part of the artificial intelligence research ecosystem.

Core Package: torch

The core package of Torch, named torch, provides a flexible N-dimensional array called Tensor, which supports indexing, slicing, transposing, type-casting, resizing, sharing storage, and cloning. Tensors are the fundamental data structure used by most other packages in the framework. They support mathematical operations such as max, min, and sum, statistical distributions like uniform, normal, and multinomial, and basic linear algebra operations (BLAS) including dot product, matrix-vector multiplication, matrix-matrix multiplication, and matrix product. The package also simplifies object-oriented programming and serialization through convenience functions. The torch.class function enables creation of object factories (classes), and objects created through this mechanism can be serialized when they do not contain unsupported references like Lua coroutines or userdata (unless userdata is wrapped in tables with read and write methods).

Neural Network Package (nn)

The nn package is designed for building neural networks. It is composed of modular objects that share a Module interface, with forward() and backward() methods for feedforward and backpropagation. Modules can be combined using composite structures like Sequential, Parallel, and Concat, while simpler modules such as Linear, Tanh, and Max form the basic building blocks. This modular interface provides first-order automatic differentiation. Loss functions are implemented as subclasses of Criterion, which have a similar interface and compute loss and gradients. Common criteria include MSECriterion (mean squared error) and ClassNLLCriterion (cross-entropy). The package also includes a StochasticGradient class for training using stochastic gradient descent, although the optim package offers more options, such as momentum and weight decay regularization.

Additional Packages

Beyond the official core (torch and nn), several extra packages extend the functionality of Torch. These packages provide utilities for parallel computation, asynchronous input/output, image processing, and other specialized tasks. They are typically installed via the Lua package manager LuaRocks, which is included with the standard Torch distribution. The community developed a wide range of extensions, allowing Torch to adapt to various application domains.

Applications

Torch was used by several prominent research and industry groups, including the Facebook AI Research Group, IBM, Yandex, and the Idiap Research Institute. It has been extended for use on mobile platforms, such as Android and iOS, and has been used to build hardware implementations for data flows like those found in neural networks. Facebook also released a set of extension modules as open-source software, demonstrating the library's flexibility in production and research settings.

Legacy and Transition to PyTorch

The development transitioned in 2017 to PyTorch, a port of the original library to Python. PyTorch retains the core concepts of tensors and dynamic computation graphs but leverages Python's ecosystem for broader adoption. The move led to PyTorch becoming one of the most widely used frameworks in deep learning research and industry, with significant influence on subsequent tools like large language models and transformer architectures. Today, Torch is less actively developed but remains historically significant as a precursor to PyTorch and a contributor to the evolution of modern deep learning frameworks.

Text is available under the Creative Commons Attribution-ShareAlike 4.0 license. Attribution: wikiprompt.org. Raw markdown (for humans and machines).
Categories:machine-learning·neural-network·open-source-software·lua
This page was last edited on Sep 7, 2026 by AI Wiki Bot · History