Skip to content
AIRepoHub

tensorflow

by tensorflow

Google's open-source machine learning framework for building and training neural networks.

Developer ToolsC++Apache 2.0 license
Stars
201,770
stars
Forks
77k
forks
Last push
today
Activity
Active
tensorflow: quick start
# Install TensorFlow (GPU support on Ubuntu and Windows)$ pip install tensorflow# Or the smaller CPU-only package$ pip install tensorflow-cpu

Commands from the project's README. Run them after installing (see below).

Overview

Understand tensorflow in 60 seconds

What it does
TensorFlow is Google's open-source platform for building, training and deploying machine learning models. It provides Python and C++ APIs plus a large ecosystem of tools and libraries.
The problem it solves
Building machine learning models from scratch means writing the maths for tensors, gradients and hardware acceleration yourself. TensorFlow provides those building blocks and runs them on CPUs and GPUs.
Why choose it
Choose it if you want a mature framework with a big ecosystem for training and deploying models, especially if your team already uses it. Many newer research projects use PyTorch, so check what the models you need are written in.
Who should use it
  • Machine learning researchers
  • Developers adding ML features to applications
  • Students learning deep learning
  • Teams deploying models to production, mobile or the web
Setup difficulty

You'll need:

  • Python with pip
  • Optional: a CUDA-enabled NVIDIA GPU on Ubuntu or Windows
  • Other devices (DirectX, macOS Metal) through device plugins

How tensorflow works

TensorFlow was created by researchers and engineers on the Google Brain team for machine learning and neural network research, and is general enough for many other uses. It offers stable Python and C++ APIs, with other language bindings that are not guaranteed to stay backward compatible.

The standard pip package includes support for CUDA-enabled GPUs on Ubuntu and Windows, and a smaller CPU-only package is available. DirectX and macOS Metal devices are supported through device plugins, and Docker images and source builds are documented on tensorflow.org.

Nightly builds are published as tf-nightly for testing. The tensorflow.org tutorials are the main place to learn it, and release and security announcements go out on the announce mailing list.

Features

Key features

End-to-end ML platform

Build, train and deploy models with one framework.

Python and C++ APIs

Stable APIs for both languages.

GPU acceleration

CUDA GPU support included in the standard package.

Device plugins

Run on DirectX and macOS Metal devices.

Large ecosystem

Tools, libraries and community resources around the core.

Docker and source builds

Official containers and build-from-source guides.

Strengths

  • Mature and widely used, backed by Google
  • Large ecosystem and documentation
  • Runs on CPUs, GPUs and other devices
  • Apache-2.0 license

Limitations

  • Big install compared with lighter libraries
  • GPU setup can take some work
  • APIs for languages other than Python and C++ may change

Practical use cases

Train an image classifier

Follow the tensorflow.org tutorials to train a model on your own images.

Add ML to an app

Train a model in Python and deploy it with the TensorFlow ecosystem.

Learn deep learning

Use it with the official tutorials to learn the basics.

Installation

Install tensorflow

Based on official documentation

Commands come from TensorFlow's README. AIRepoHub hasn't run them yet. View source

Prerequisites

  • Python and pip

Supported systems

  • Windows
  • macOS
  • Linux
  1. 1

    Install the current release

    Includes CUDA GPU support on Ubuntu and Windows.

    Shell
    pip install tensorflow
  2. 2

    Upgrade later

    Shell
    pip install --upgrade tensorflow
  1. 1

    Install the smaller CPU-only package

    Shell
    pip install tensorflow-cpu

Configuration and API keys

SettingWhat it's for

First run

  1. 1

    Start Python

    Shell
    python
  2. 2

    Run a first operation

    Text
    import tensorflow as tftf.add(1, 2).numpy()

tensorflow's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.

Your first project

Run your first TensorFlow program

Check that TensorFlow works by running a couple of operations in Python.

Before you start

  • TensorFlow installed with pip
  1. 1

    Start Python

    Shell
    python
  2. 2

    Add two numbers

    Text
    import tensorflow as tftf.add(1, 2).numpy()
  3. 3

    Make a string tensor

    Text
    hello = tf.constant('Hello, TensorFlow!')hello.numpy()

What to expect

The first call returns 3 and the second returns b'Hello, TensorFlow!'.

Next steps

  • Work through the TensorFlow tutorials on tensorflow.org
  • Set up GPU support from the install guide
  • Try a Docker container for a reproducible setup

Costs and requirements

What it costs to run

License
Apache-2.0. Free to use, modify and use commercially.Free
Software
Free and open source.Free
Hardware
Training large models may need GPUs, which cost money if rented.Depends

Troubleshooting

Common setup issues

GPU isn't used

GPU support in the pip package covers CUDA-enabled cards on Ubuntu and Windows. See the GPU install guide on tensorflow.org.

Source: README.md

Running on a Mac GPU or DirectX

Use the device plugins described in the install guide.

Source: README.md

Want the newest fixes

Try the tf-nightly package for testing.

Source: README.md

Alternatives

Similar AI repositories