current position:Home>Introduction to TensorFlow

Introduction to TensorFlow

2022-08-06 09:33:40Ding Jiaxiong

3. Introduction to TensorFlow

3.1 Dependent Views

insert image description here

Hosted on the GitHub platform and maintained by Google groups and contributors

Provide rich APIs related to deep learning, support Python and C/C++ interfaces

Provide a visual analysis tool Tensorboard for easy analysis and adjustment of the model

Supports various platforms such as Linux, Windows, Mac and even mobile devices

3.2 TensorFlow2.0 focuses on simplicity and ease of use

3.2.1 Workflow

  • Load data using tf.data
  • Model building and debugging
  • Model training
  • Pre-trained model call
  • Deployment of the model

3.2.2 TensorFlow installation

pip install tensorflow==2.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

insert image description here

3.3 Tensors

3.3.1 Tensors and related operations

  • Tensor is a multidimensional array

    • 0-dimensional→scalar, one-dimensional tensor, two-dimensional, three-dimensional...
  • Generate Tensor

    • tf.constant
  • tensor to numpy

    • np.array()
    • Tensor.numpy()
  • Common functions

    • Addition

      • tf.add
    • Element-wise multiplication

      • tf.muliply
    • Matrix Multiplication

      • tf.matmul
    • insert image description here

3.3.2 Variables

  • A special kind of tensor whose shape is immutable, but whose parameters can be changed
  • tf.Variable
  • insert image description here

3.4 tf.keras

3.4.1 High-level API of TensorFlow2.0

  • New styles and design patterns for TensorFlow code
  • Improve the simplicity and reusability of TF code

3.4.2 Common Modules

  • insert image description here

3.4.3 Common Methods

  • The main process of deep learning implementation

    • Data acquisition
    • Data processing
    • Model creation and training
    • Model testing and evaluation
    • Model predictions
  • Import tf.keras

  • Data entry

  • Model building

  • Training and Evaluation

  • Callback function

  • Model save and restore

3.5 Quick Start Model

3.5.1 Iris Classification Case

  • Implementation using machine learning sklearn logistic regression

    • insert image description here

    • insert image description here

  • Implementation using tf.Keras

    • insert image description here

copyright notice
author[Ding Jiaxiong],Please bring the original link to reprint, thank you.
https://en.chowdera.com/2022/218/202208060925358907.html

Random recommended