Introduction to TensorFlow

TensorFlow is a Python library for fast numerical computing created and released by Google.It is a foundation library that can be used to create deep learning models directly or by using wrapper libraries that simplify the process built on top of TensorFlow.After completing this lesson you will know :

  • About the TensorFlow library for Python
  • How to define, compile and evaluate a simple symbolic expression in TensorFlow.
  • Where to go to get more information on the Library.

3.1 What is TensorFlow ?

TensorFlow is an open source library for fast numerical computing. It was created and is maintained by Google and released under the Apache 2.0 open source license. The API is nominally for the Python programming language, although there is access to the underlying C++ API. Unlike other numerical libraries intended for use in Deep Learning like Theano, TensorFlow was designed for use both in research and development and in production systems, not least RankBrain in Google search1 and the fun DeepDream project2. It can run on single CPU systems, GPUs as well as mobile devices and large scale distributed systems of hundreds of machines.

3.2 How to Install TensorFlow

D:\maxwelllearning\maxwellhandon\Deep learning with python\cp3>pip install --user --upgrade tensorflow

3.3 You First Examples in TensorFlow

Computation is described in terms of data flow and operations in the structure of a directed graph.

  • Nodes: Nodes perform computation and have zero or more inputs and outputs. Data that moves between nodes are known as tensors, which are multi-dimensional arrays of real values.
  • Edges: The graph defines the flow of data, branching, looping and updates to state. Special edges can be used to synchronize behavior within the graph, for example waiting for computation on a number of inputs to complete.
  • Operation: An operation is a named abstract computation which can take input attributes and produce output attributes. For example, you could define an add or multiply operation.

3.4 Simple TensorFlow Example

# Example of TensorFlow library
# import tensorflow as tf
#import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# declare two symbolic floating-point scalars
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)

# create a simple symbolic expression using the add function
add = tf.add(a, b)

# bind 1.5 to 'a', 2.5 to 'b', and evaluate 'c'
sess = tf.Session()
binding = {a: 1.5, b: 2.5}
c = sess.run(add, feed_dict=binding)
print(c)

 

3.5 More Deep Learning Models

import os; import inspect; import tensorflow;print(os.path.dirname(inspect.getfile(tensorflow)))

 

3.6 Summary

In this lesson you discovered the TensorFlow Python library for deep learning. You learned:

  • TensorFlow is another efficient numerical library like Theano
  • Like Theano,deep learning models can be developed directly in TensorFlow if desired.
  • Also Like Theano,TensorFlow may be better leveraged by a wrapper library that abstracts the complexity and lower level details.

3.6.1 Next

You now know about the Theano and TensorFlow libraries for efficient computation in Python. In the next lesson you will discover the Keras library that wraps both libraries and gives you a clean and simple API for developing and evaluating deep learning models.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值