Forward logo

Forward

Tencent/Forward

A library for high performance deep learning inference on NVIDIA GPUs

GraphCanon updated 2w · GitHub synced 2w

556 stars63 forksLast push 4y C++ Other

Decision brief

Forward is an NVIDIA GPU-based high-performance deep learning inference library that converts popular framework models directly into TensorRT for optimized inference.

Good fit when

  • When you need to quickly integrate TensorFlow, PyTorch, Keras, or ONNX models on NVIDIA GPUs for inference and require minimal conversion effort.
  • For projects that benefit from the explicit support of advanced models like BERT, FaceSwap, and StyleTransfer within CV, NLP, and recommendation domains.

Avoid when

  • If your project requires model serving or inference on CPU-only environments, as Forward is optimized for NVIDIA GPUs.
  • For users who need extensive customization beyond the supported models (TensorFlow, PyTorch, Keras, ONNX) as expanding support necessitates additional engineering effort.

Observed Jul 16, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Dormant (1647d since push)
As of 2w
Provenance
Not a fork · Organization account
As of 2w
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Install

git clone https://github.com/Tencent/Forward

Similar tools

Same-category neighbours. No typed graph edges are catalogued for this tool yet.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Forward is a high-performance deep learning inference acceleration framework developed by Tencent to load models from popular frameworks such as TensorFlow, PyTorch, Keras, and ONNX directly into the TensorRT inference engine. It simplifies model conversion procedures and provides support for various data types (FLOAT/HALF/INT8). The library supports both C++ and Python interfaces.

Capability facts

Languages
c++

Source: github.language · Aug 4, 2026

Categories

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 4, 2026)

- [Forward-Python 使用](#forward-python-使用)
Source link

Tags

README

Forward 深度学习推理加速框架


  • Forward 深度学习推理加速框架
    • 什么是 Forward
    • 为什么选择 Forward
    • 快速上手 Forward
      • 环境依赖
      • 项目构建
      • Forward-Cpp 使用
      • Forward-Python 使用
      • Forward-Bert 使用
      • 更多使用方法
      • Logging 日志
    • 模型和算子支持
      • 模型
      • 算子
    • 参考资料
    • 贡献
    • 许可证

[English Version]

什么是 Forward

Forward 是一款腾讯研发的 GPU 高性能推理加速框架。它提出了一种解析方案,可直接加载主流框架模型(Tensorflow / PyTorch / Keras / ONNX)转换成 TensorRT 推理加速引擎,帮助用户节省中间繁杂的模型转换或网络构建步骤。相对于直接使用 TensorRT,Forward 更易用以及更容易扩展支持更多模型和算子。目前,Forward 除了覆盖支持主流的 CV,NLP 及推荐领域的深度学习模型外,还支持一些诸如 BERT,FaceSwap,StyleTransfer 这类高级模型。

为什么选择 Forward

  • 模型性能优化高:基于 TensorRT API 开发网络层级的支持,保证对于通用网络层级的推理性能优化处于最优级别;
  • 模型支持范围广:除了通用的 CV,NLP,及推荐类模型,还支持一些诸如 BERT,FaceSwap,StyleTransfer 这类高级模型;
  • 多种推理模式:支持 FLOAT / HALF / INT8 推理模式;
  • 接口简单易用:直接导入已训练好的 Tensorflow(.pb) / PyTorch(.pth) / Keras(.h5) / ONNX(.onnx) 模型文件,隐式转换为高性能的推理 Engine 进行推理加速;
  • 支持自研扩展:可根据业务模型扩展支持自定义网络层级
  • 支持 C++ 和 Python 接口调用

快速上手 Forward

环境依赖

  • NVIDIA CUDA >= 10.0, CuDNN >= 7 (推荐 CUDA 10.2 以上)
  • TensorRT >= 7.0.0.11 (推荐 TensorRT-7.2.1.6)
  • CMake >= 3.12.2
  • GCC >= 5.4.0, ld >= 2.26.1
  • PyTorch >= 1.7.0
  • TensorFlow >= 1.15.0 (若使用 Linux 操作系统,需额外下载 Tensorflow 1.15.0,并将解压出来的 .so 文件拷贝至 Forward/source/third_party/tensorflow/lib 目录下)
  • Keras HDF5 (从 Forward/source/third_party/hdf5 源码构建)

项目构建

使用 CMake 进行构建生成 Makefiles 或者 Visual Studio 项目。根据使用目的,Forward 可构建成适用于不同框架的库,如 Fwd-Torch、Fwd-Python-Torch、Fwd-Tf、Fwd-Python-Tf、Fwd-Keras、Fwd-Python-Keras、Fwd-Onnx 和 Fwd-Python-Onnx。

以 Linux 平台构建 Fwd-Tf 为例,

步骤一:克隆项目

1 git clone https://github.com/Tencent/Forward.git

步骤二:下载 Tensorflow 1.15.0(仅在 Linux 平台使用 Tensorflow 框架推理时需要)

1 cd Forward/source/third_party/tensorflow/
2 wget https://github.com/neargye-forks/tensorflow/releases/download/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
3 tar -xvf libtensorflow-gpu-linux-x86_64-1.15.0.tar.gz

步骤三:创建 build 文件夹

1 cd ~/Forward/
2 rm -rf build
3 mkdir -p build
4 cd build/

步骤四:使用 cmake 生成构建关系,需指定 TensorRT_ROOT 安装路径

1 cmake ..  -DTensorRT_ROOT=<path_to_TensorRT> -DENABLE_TENSORFLOW=ON -DENABLE_UNIT_TESTS=ON

步骤五:使用 make 构建项目

1 make -j

步骤六:运行 unit_test 验证项目是否构建成功

cd bin/
./unit_test --gtest_filter=TestTfNodes.*

# 出现已下提示表示项目构建成
# [       OK ] TestTfNodes.ZeroPadding (347 ms)
# [----------] 22 tests from TestTfNodes (17555 ms total)

# [----------] Global test environment tear-down
# [==========] 22 tests from 1 test case ran. (17555 ms total)
# [  PASSED  ] 22 tests.

更多构建流程可参考 CMake 构建流程

Forward-Cpp 使用

参考 Demo for using Forward-Cpp in Linux

Forward-Python 使用

参考 Demo for using Forward-Python

Forward-Bert 使用

Refer to Demo for using Forward-Bert

更多使用方法

注意: 模型输入名可通过模型查看器来查看, 例如用 Netron 查看。

  • PyTorch 使用说明
  • TensorFlow 使用说明
  • Keras 使用说明
  • ONNX 使用说明

Logging 日志

Forward 使用 easylogging++ 作为日志功能,并使用 forward_log.conf 作为日志配置文件。

  • 若工作目录中存在 forward_log.conf 文件,Forward 将使用该配置文件,更多内容可参考 Using-configuration-file
  • 若工作目录中不存在 forward_log.conf 文件,Forward 将使用默认配置,并将日志记录到 logs/myeasylog.log

forward_log.conf 文件配置样例

* GLOBAL:
  FORMAT               =  "[%level] %datetime %fbase(%line): %msg"
  FILENAME

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.