TensorFlow Study Notes (1) - Basic concepts and framework

Frequently asked questions when the entry frame

The reason the framework of learning?

  • Convenient, easy to use

What knowledge learning framework?

  • A project to master the basic process, we know what knowledge needs to learn

The method of rapid learning framework

  • The project required flow of each targeted school
  • You can see the official Tutorial

TensorFlow Getting Started mind map

(Map)

TensorFlow high-level API

TF SLIM: a possible definition, training and evaluation of complex models lightweight library (when used in detail)

TF Learn (tf.contrib.learn): similar scikit-learn interface

Other: Keras, etc.

TensorFlow Learning Points

  • type of data
  • Operating mechanism
  • Data I / O
  • Training model
  • Save Model
  • Call model

TensorFlow basic development process

Project Flow

Data preprocessing -> model training -> Save model -> model predictions

  • Data Preprocessing: data ready, data cleaning, characterized in engineering, normalization
  • Neural networks and machine learning different traditions, do not need to do a lot of feature works after feeding characteristics, only need to set up the network structure, the raw input data to complete the training.
  • Can first be treated normalization of raw data, avoiding training errors.

Two steps of the preparation TensorFlow

  1. Construction FIG calculation graph
  2. Use Session to perform graph of operation

Wherein the base is defined according to

Tensor

  1. Type of multi-dimensional array, is Edges

  2. ? ? ? Is an N-dimensional matrix, can be seen as a symbolic of the handle, it points to the calculation result memory, returning after performing basic types, e.g. numpy array, list, etc.

  3. Creation Method:

    1. tf.zeros()
    2. tf.ones()
    3. tf.fill()
    4. tf.constant()
    5. tf.random_uniform()
    6. tf.random_normal()
    7. ......
  4. Three properties: rank, shape, data_type

    • Rank: refers to the dimension data of the data, the rank and linear algebra is not a concept

      (Map)

      rank = 0 (scalar), 1 (vector), 2 (matrix), 3 ~ n (n dimension the Tensor)

      Note that the relationship between the rank and shape!

    • Shape: Tensor refers to the number of each dimension of the data may be / tuple list represented in Python

      The relationship between Rank and Shape:

      (Map)

    • Data_type: it refers to a single data type. Common DT_FLOAT, i.e. 32-bit floating-point number.

      All Types are as follows:

      (Map)

Operation

  1. Unit performs the calculations, the node of FIG.
  2. Is a symbolic computation process, is the basic unit of TensorFlow. A computing node, the input and output are in Graph Tensor
  3. Creation Method:
    1. tf.add()
    2. ......

Graph

  1. Figure sides have a point, which represents a task needs to be calculated

  2. TensorFlow calculable using FIG tf.Graph represented, by the operating FIG tensor Tensor Operation and configuration, wherein the nodes of the graph represents Operation (i.e. arithmetic unit), and the edges of the graph indicates Tensor (i.e. in the Op the flow of data between the units)

  3. Creation Method:

    • tf.Graph._ init _ () (MK syntax restrictions, underscore without spaces): Create a new empty Graph

    • In the presence of TF in itself a default Graph, if you do not need to directly create map

    • Tf.Graph in the call with (). As_default () This method of calculating the default may be provided in FIG.

      (Map)

Session

  1. Call session context for performing FIG.

  2. Operation execution and provide environmental evaluation of Tensor

    (Map)

  3. Use of distributed computing, designated GPU / CPU

  4. Release resources

    • Call session.close () method

      (Map)

    • Use with tf.Session () to create a context (Context) to perform, when the context quit, resources are automatically released

      (Map)

Relations between the three basic concepts:

(Map)

Tensor and Operation of Graph objects are, Operation FIG nodes, and as side Tensor, connect Op. The Graph and can only be executed in Session

An example of a

(Map)

  • In a separate operation defined and Tf perform this calculation in FIG.
  • Create a complete calculation:
    1. Creating Tensor
    2. Add Operation
    3. Creating Session, running Graph
  • This figure has three Operation, however Operation input is not output, because the output can perform calculations, but not enter.
  • Operation is not performed immediately after the addition, TensorFlow will wait after all are added to Graph Operation in accordance with the final output of the corresponding operation requires Operation.

The basic functions TensorFlow

Veriable

  1. Role: save and update the parameters stored in the memory

(To be continued)

Guess you like

Origin www.cnblogs.com/LYT-Dveloper/p/11255930.html