search
HomeBackend DevelopmentPython TutorialThe concept and installation of TensorFlow, a deep learning framework

On November 9, 2015, Google released the artificial intelligence system TensorFlow and announced it as open source.

1. The concept of TensorFlow

TensorFlow is an open source software library that uses data flow graphs for numerical calculations. In other words, TensorFlow uses graphs to represent computing tasks. The nodes in the graph represent mathematical operations, and the edges represent multi-dimensional arrays (that is, tensors) used to communicate between operations. TensorFlow's flexible architecture allows you to deploy computing processes to one or more CPUs or GPUs.

TensorFlow was originally developed by researchers and engineers from the Google Brain Team and is primarily used by Google's Machine Intelligence research organization for machine learning and deep neural network research, but the system is also general in many other fields. .

The concept and installation of TensorFlow, a deep learning framework

#The abstract representation of the model is automatically handled by the framework, which makes TensorFlow and Theano particularly suitable for developing new models based on gradient optimization algorithms.

The main disadvantage of Theano is the long compilation time of the above symbolic model, and TensorFlow effectively improves this, that is, the compilation time is shorter.

Another advantage of TensorFlow is its supporting tool-TensorBoard, which visualizes the training process of the model. In this way, users can interactively examine the structure of the model and observe changes in parameters and model performance.

The open source version of TensorFlow can only run on one machine, but it supports parallel computing on multiple processors (CPUs or GPUs).

1.1 What is a data flow diagram?

Data flow diagrams use directed graphs to describe mathematical calculations, with points and edges in the graph.

Nodes usually perform mathematical calculations, but can also serve as endpoints to represent results, or read/write persistent variables.

Edges are used to describe the input/output relationships between nodes. These edges carry multidimensional arrays or tensors of variable size.

These nodes are assigned to computing devices and executed asynchronously. Once all tensors arrive at the same time, parallel calculations will be performed.

Due to the flow of tensors in the graph, we call it TensorFlow.

Tensors Flowing

1.2 Features of TensorFlow

  1. Deep Flexibility, flexibility. TensorFlow is not a rigid neural network library. As long as you can express your calculation process as a data flow graph, you can use TensorFlow. Defining a new calculation is as simple as writing a Python function and the cost is not high. If you can't see the underlying data operations you need, you can add them through C++.

  2. True Portability, portability. TensorFlow runs on a CPU or GPU and can run on a laptop, server, or mobile computing platform. Models can be trained on mobile devices without special hardware or code changes, and computing can be performed on the cloud by encapsulating Docker and TensorFlow.

  3. Connect Research and Production, both academic and industrial. At Google, scientists use TensorFlow to test new algorithms, and product teams use TensorFlow to train models to serve users.

  4. Auto-Differentiation, automatic identification. TensorFlow's automatic discrimination capabilities are beneficial for implementing gradient-based machine learning algorithms. When you use TensorFlow, you define the calculation framework structure for your prediction model, plus the objective function. Then you only need to add data, and TensorFlow will calculate the derivative, that is, the gradient for you.

  5. Language Options, language selection. TensorFlow can use the Python interface and the simple C++ interface to build and execute your computational graphs. If you are interested, you can also provide an interface in your favorite language - Lua, JavaScript, or R, etc.

  6. Maximize Performance, maximize performance. TensorFlow allows you to take full advantage of the hardware you have available: 32 CPU cores and 4 GPU cards, threads, queues, asynchronous calculations, etc. You can freely allocate the computing elements in the TensorFlow graph to different devices and let TensorFlow handle them.

1.3 Who can use TensorFlow?

Students, researchers, enthusiasts, hackers, engineers, developers, inventors, innovators and more.

TensorFlow is currently not complete and it needs to be extended. Google only gave an initial version of the source code, and they hope to build an active open source community to make TensorFlow better and better.

Companies currently using TensorFlow include: Google, Uber, Twitter, DeepMind, JD.com, etc.

1.4 Why does Google open source TensorFlow?

"TensorFlow" is Google's internal machine learning system for many years. Today, Google is making this system an open source system and publishing the parameters of this system to industry engineers, scholars, and technicians with a large number of programming capabilities. What does this mean?

The answer is simple: Google believes that machine learning is a key component of future innovation. Research in this field is global and developing rapidly, but there is a lack of standard tools. Google engineers are using TensorFlow to develop user-oriented products and services. Google's research team also plans to share the implementation process of TensorFlow. They hope that TensorFlow can become one of the best tools for machine learning.

To use an inappropriate metaphor, Google’s current treatment of the TensorFlow system is somewhat similar to its treatment of its mobile operating system Android. If more data scientists start using Google's systems to conduct machine learning research, it will help Google gain more dominance over the growing machine learning industry.

1.5 TensorFlow and Computational Biology

There is a prerequisite for using current deep learning methods: having a data set with many samples.

Like identifying genes or methylation probes related to specific diseases, the sample set is very small, so it cannot be analyzed with deep learning. [Crying... I just want to use deep learning to identify disease genes...]

If you want to use a deep learning model, the first step is to solve the problem of how to represent the data. Such as: splice junctions, RNA-protein binding sites, or methylation. In other words, the number of your samples far exceeds the number of variables.

So, as long as this critical step is solved, TensorFlow will open the door to deep learning for you.

2. Tensorflow installation (based on pip)

Pip is a Python software package installation and management tool. Moreover, Tensorflow can only be installed in a Linux environment. For details on installing a Linux system under VMware, please refer to my other blog.

2.1 Install pip (need to install under super administrator privileges)

  1. ##sudo apt-get install python-pip python-dev

The concept and installation of TensorFlow, a deep learning framework

The concept and installation of TensorFlow, a deep learning framework

Note: The above interface appears indicating that pip has been installed successfully!

2.2 Install Tensorflow

  1. sudo pip install --upgrade https:

    //storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

##2.3 Test

    >>>
  1. import tensorflow

    as tf

    ##>>> hello = tf.
  2. constant
  3. (

    'Hello, TensorFlow!')##> ;>> sess = tf.

    Session
  4. (
  5. )

    #>>> print sess.

    run
  6. (hello
  7. )

    ##Hello, TensorFlow !

  8. Note: Exit Python method under Linux: Ctrl+D
2.4 Install IDE Download the Community version for Linux from Pycharm

official website and install it according to the steps of the official website tutorial.

Note: You can download it directly from the browser in Linux.

First, copy the file to the location where you want to install it.

The concept and installation of TensorFlow, a deep learning framework

cd

/home/andy

  1. Then unzip the file:

tar xfz pycharm-community-

2016.3.

tar.
gz
  1. Open the directory where the pycharm.sh file is located:

    1. cd pycharm-community-2016.3/bin

    Run the pycharm.sh file to install pycharm:

    1. ##./pycharm.

      sh

    After installation, pycharm will automatically open, and then a series of settings will be made:

    The concept and installation of TensorFlow, a deep learning framework

    The concept and installation of TensorFlow, a deep learning framework

    The concept and installation of TensorFlow, a deep learning framework

    When the following interface appears, the installation is successful.

    Select "Create New Project" to create a new project. The default compiler is python 2.7. The concept and installation of TensorFlow, a deep learning framework

    Then right-click on the newly created project and select "New->Python File" to create a new python file Py01. The concept and installation of TensorFlow, a deep learning framework

    Write a piece of code in the file Py01 for testing. The concept and installation of TensorFlow, a deep learning framework

    It can be seen that the test results are correct and you can import tensorflow on Pycharm! The concept and installation of TensorFlow, a deep learning framework

    2.5 Lock Pycharm to the launcherThe concept and installation of TensorFlow, a deep learning framework

    Under Ubuntu, you need to find the folder where pycharm.sh is located every time and execute ./pycharm. sh, opening pycharm is very troublesome.

    So, we'd better create a shortcut. Ubuntu shortcuts are placed under "Computer/usr/share/applications".

    First create a Pycharm.desktop in this directory:

    sudo gedit
      /usr/share
    1. /applications/

      Pycharm.desktop

    2. Then enter the following content. Note that Exec and Icon need to find the correct ones in your own computer. You also need to determine the version number of Pycharm in the path, GenericName and Comment according to the actual situation:

      [
    1. Desktop

      Entry]

      ##Type=
    2. Application
    3. Name=
    4. Pycharm
    5. GenericName=
    6. Pycharm2017
    7. Comment=
    8. Pycharm2017
    9. :The

      Python IDE##Exec=

      "/home/wangfang/Pycham/pycharm-community-2017.1.3/bin/pycharm.sh" %f
    10. Icon=

      /home/wangfang/Pycham
    11. /pycharm-community-2017.1.3/
    12. bin/pycharm.

      pngTerminal=pycharm

    13. ##Categories=Pycharm;

    14. After saving, you can find the corresponding desktop Pycharm.desktop file through the path /usr/share/applications/, then double-click to open it, and then lock it to the launcher.

      The concept and installation of TensorFlow, a deep learning framework1

      Reference:

      1. TensorFlow official website

      2. Geek Academy—TensorFlow official document Chinese version

      3. Geek Academy—Download and Installation

      4. Geek Academy—MNIST Machine Learning Getting Started (Building a Softmax Regression Model)

      5. Geek Academy - In-depth MNIST (Building a Deep Convolutional Neural Network)

      6. Ladislav Rampasek and Anna Goldenberg, TensorFlow: Biology's Gateway to Deep Learning?

      7. werm520's column: Installing PyCharm on Ubuntu

      8. Installing Anaconda under Ubuntu

      9. Installing Anaconda and Spyder under Linux (Ubuntu14.04)

      10. How to install TensorFlow under Ubuntu


The above is the detailed content of The concept and installation of TensorFlow, a deep learning framework. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Python and Time: Making the Most of Your Study TimePython and Time: Making the Most of Your Study TimeApr 14, 2025 am 12:02 AM

To maximize the efficiency of learning Python in a limited time, you can use Python's datetime, time, and schedule modules. 1. The datetime module is used to record and plan learning time. 2. The time module helps to set study and rest time. 3. The schedule module automatically arranges weekly learning tasks.

Python: Games, GUIs, and MorePython: Games, GUIs, and MoreApr 13, 2025 am 12:14 AM

Python excels in gaming and GUI development. 1) Game development uses Pygame, providing drawing, audio and other functions, which are suitable for creating 2D games. 2) GUI development can choose Tkinter or PyQt. Tkinter is simple and easy to use, PyQt has rich functions and is suitable for professional development.

Python vs. C  : Applications and Use Cases ComparedPython vs. C : Applications and Use Cases ComparedApr 12, 2025 am 12:01 AM

Python is suitable for data science, web development and automation tasks, while C is suitable for system programming, game development and embedded systems. Python is known for its simplicity and powerful ecosystem, while C is known for its high performance and underlying control capabilities.

The 2-Hour Python Plan: A Realistic ApproachThe 2-Hour Python Plan: A Realistic ApproachApr 11, 2025 am 12:04 AM

You can learn basic programming concepts and skills of Python within 2 hours. 1. Learn variables and data types, 2. Master control flow (conditional statements and loops), 3. Understand the definition and use of functions, 4. Quickly get started with Python programming through simple examples and code snippets.

Python: Exploring Its Primary ApplicationsPython: Exploring Its Primary ApplicationsApr 10, 2025 am 09:41 AM

Python is widely used in the fields of web development, data science, machine learning, automation and scripting. 1) In web development, Django and Flask frameworks simplify the development process. 2) In the fields of data science and machine learning, NumPy, Pandas, Scikit-learn and TensorFlow libraries provide strong support. 3) In terms of automation and scripting, Python is suitable for tasks such as automated testing and system management.

How Much Python Can You Learn in 2 Hours?How Much Python Can You Learn in 2 Hours?Apr 09, 2025 pm 04:33 PM

You can learn the basics of Python within two hours. 1. Learn variables and data types, 2. Master control structures such as if statements and loops, 3. Understand the definition and use of functions. These will help you start writing simple Python programs.

How to teach computer novice programming basics in project and problem-driven methods within 10 hours?How to teach computer novice programming basics in project and problem-driven methods within 10 hours?Apr 02, 2025 am 07:18 AM

How to teach computer novice programming basics within 10 hours? If you only have 10 hours to teach computer novice some programming knowledge, what would you choose to teach...

How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading?How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading?Apr 02, 2025 am 07:15 AM

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor