explaingit

torch/torch7

9,120CAudience · researcherComplexity · 4/5Setup · hard

TLDR

Torch7 is an early machine learning framework written in C with a Lua scripting layer, now unmaintained and preserved as a historical reference, with its ideas carried forward in modern PyTorch.

Mindmap

mindmap
  root((repo))
    What it does
      Tensor operations
      Neural networks
      Math at scale
    History
      Precursor to PyTorch
      Early deep learning
      Research labs
    Components
      Math operations
      File serialization
      Random numbers
    Status
      Unmaintained
      Legacy reference
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study the historical design of tensor-based computing primitives that later evolved into PyTorch.

USE CASE 2

Maintain or debug legacy research code that still depends on Torch7.

USE CASE 3

Understand how scientific computing frameworks were structured before modern Python ML tools existed.

Tech stack

CLuaCUDA

Getting it running

Difficulty · hard Time to first run · 1day+

Project is no longer maintained with near-zero community support, PyTorch is the recommended modern replacement.

License not described in the explanation.

In plain English

Torch7 is an early scientific computing framework built around a concept called tensors, which are multi-dimensional numerical arrays. Think of a tensor as a spreadsheet extended into more dimensions: a one-dimensional tensor is a list of numbers, a two-dimensional tensor is a grid, and so on. These structures are the basic building block for doing math at scale, particularly for machine learning, where you need to process large batches of data through mathematical operations quickly. The framework was written in C, with a Lua scripting interface on top. It provided the tools researchers needed to build and train neural networks before the current generation of Python-based tools existed. Torch7 was used at major research labs and was influential in the development of deep learning during the early 2010s. The README is direct about the current state of the project: it is no longer in active development. The underlying C libraries that Torch7 was built on (called TH, THNN, THC, and THCUNN) were rewritten and extended as part of PyTorch, which is now the dominant framework for this kind of work. The README points developers toward PyTorch as the continuation of this line of work. What remains in this repository is the reference implementation and documentation. The Torch package itself covers tensor creation and manipulation, mathematical operations, file reading and writing, serialization (saving and loading objects), a timer, a command-line argument parser, and a random number generator. These are the foundational utilities a researcher would need when running experiments. Community support as of 2019 is described as close to non-existent. The project is preserved here as a historical reference and for anyone maintaining legacy code that still depends on it.

Copy-paste prompts

Prompt 1
Show me how tensor operations work in Torch7's Lua API and explain how they map to equivalent PyTorch operations in Python.
Prompt 2
Help me migrate a Torch7 training script written in Lua to modern PyTorch.
Prompt 3
Explain the difference between the TH, THNN, THC, and THCUNN libraries in Torch7 and what each one is responsible for.
Prompt 4
I have legacy code that uses Torch7, help me identify what dependencies it needs and how to run it today.
Open on GitHub → Explain another repo

← torch on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.