whatisgithub

What is tnn?

tencent/tnn — explained in plain English

Analysis updated 2026-06-26

4,631C++Audience · developerComplexity · 4/5Setup · hard

In one sentence

A Tencent framework for running AI models on phones and computers at high speed, supporting CPUs, GPUs, and specialized AI chips across Android, iOS, and Linux, no cloud required.

Mindmap

mindmap
  root((TNN))
    What it does
      On-device AI inference
      Cross-platform support
    Hardware
      CPU any device
      Mobile GPUs
      Huawei AI chip
      Apple Neural Engine
    Tasks
      Face detection
      Body pose
      Text recognition
      Object detection
    Platforms
      Android
      iOS
      Linux desktop
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

What do people build with it?

USE CASE 1

Run face detection or body pose estimation on an Android or iPhone without sending video to a server.

USE CASE 2

Deploy the same trained AI model across Android, iOS, and Linux from a single C++ codebase.

USE CASE 3

Use TNN's text recognition demo to read printed or handwritten characters in photos directly on device.

USE CASE 4

Convert a model from another framework and benchmark it across CPU, GPU, and dedicated AI chip backends.

What is it built with?

C++AndroidiOSLinux

How does it compare?

tencent/tnnzufuliu/notepad4multimc/launcher
Stars4,6314,6334,625
LanguageC++C++C++
Setup difficultyhardeasyeasy
Complexity4/51/52/5
Audiencedevelopervibe codergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires Android NDK or Xcode plus device-specific build configuration for each target platform.

So what is it?

TNN is a framework from Tencent that lets you run AI models on phones, computers, and servers. The problem it solves is this: AI models are usually trained on powerful computers in the cloud, but you often want them to run locally on a device, such as detecting faces in a camera feed on a phone without sending video to a server. TNN takes a trained model and runs it as fast as possible on whatever hardware is available. The framework supports many different types of processors and chips, including the standard CPU inside any phone, graphics chips (GPUs), and specialized AI chips made by companies like Huawei and Apple. This means the same AI model can be deployed across Android phones, iPhones, desktop computers, and servers, with the framework choosing the best available chip on each device to keep things fast. Tencent uses TNN in several of its own apps, including mobile QQ and the photo editing app Pitu. The kinds of tasks it handles include detecting faces in images, estimating body poses, reading text in photos (including Chinese characters at odd angles), and identifying objects in a scene. Demos for all of these are included in the repository with links to the model files. For developers, TNN accepts models in several common formats and provides tools to convert models from other frameworks. The library is written in C++ and includes example code for Android, iOS, and Linux. The README has a large compatibility table showing which demos work on which hardware backends. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
Show me how to integrate TNN into an Android app to run a face detection model locally without an internet connection.
Prompt 2
Convert my PyTorch model to TNN format and run it on an iPhone using TNN's iOS example code.
Prompt 3
I want to estimate body poses from a live camera feed on Android using TNN. Which demo should I start with and what hardware backends does it support?
Prompt 4
Explain how TNN selects the best chip on a device and show me how to force it to use the GPU backend in code.

Frequently asked questions

What is tnn?

A Tencent framework for running AI models on phones and computers at high speed, supporting CPUs, GPUs, and specialized AI chips across Android, iOS, and Linux, no cloud required.

What language is tnn written in?

Mainly C++. The stack also includes C++, Android, iOS.

How hard is tnn to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is tnn for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.