Skip to content

💥🔮 Tensorflow Introductory Course with no other Prerequisites.

License

Notifications You must be signed in to change notification settings

codexponent/tensorflow101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tensorflow101


TensorFlow™ is an open source software library for high performance numerical computation. Its flexible architecture allows easy deployment of computation across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to mobile and edge devices. Originally developed by researchers and engineers from the Google Brain team within Google’s AI organization, it comes with strong support for machine learning and deep learning and the flexible numerical computation core is used across many other scientific domains.
Starting in 2011, Google Brain built DistBelief as a proprietary machine learning system based on deep learning neural networks. Its use grew rapidly across diverse Alphabet companies in both research and commercial applications. Google assigned multiple computer scientists, including Jeff Dean, to simplify and refactor the codebase of DistBelief into a faster, more robust application-grade library, which became TensorFlow. In 2009, the team, led by Geoffrey Hinton, had implemented generalized backpropagation and other improvements which allowed generation of neural networks with substantially higher accuracy, for instance a 25% reduction in errors in speech recognition. TensorFlow is Google Brain's second generation system. Version 1.0.0 was released on February 11, 2017. While the reference implementation runs on single devices, TensorFlow can run on multiple CPUs and GPUs (with optional CUDA and SYCL extensions for general-purpose computing on graphics processing units). TensorFlow is available on 64-bit Linux, macOS, Windows, and mobile computing platforms including Android and iOS. TensorFlow computations are expressed as stateful dataflow graphs. The name TensorFlow derives from the operations that such neural networks perform on multidimensional data arrays. These arrays are referred to as "tensors". In June 2016, Dean stated that 1,500 repositories on GitHub mentioned TensorFlow, of which only 5 were from Google. In May 2016, Google announced its Tensor processing unit (TPU), an ASIC built specifically for machine learning and tailored for TensorFlow. TPU is a programmable AI accelerator designed to provide high throughput of low-precision arithmetic (e.g., 8-bit), and oriented toward using or running models rather than training them. Google announced they had been running TPUs inside their data centers for more than a year, and had found them to deliver an order of magnitude better-optimized performance per watt for machine learning. In May 2017, Google announced the second-generation, as well as the availability of the TPUs in Google Compute Engine. The second-generation TPUs deliver up to 180 teraflops of performance, and when organized into clusters of 64 TPUs, provide up to 11.5 petaflops. In February 2018, Google announced that they were making TPUs available in beta on the Google Cloud Platform. In May 2017, Google announced a software stack specifically for Android development, TensorFlow Lite, beginning with Android Oreo.

Status


GitHub license

Download and Installation


To begin using this project, follow the following options to get started:

Usage


  • Fork or clone this repository and run on your IPython Notebook

Features


  • Easy to learn topics with enough descriptions
  • Clean code

Code


Tensorflow.

TensorFlow™ is an open source software library for high performance numerical computation. Its flexible architecture allows easy deployment of computation across a variety of platforms (CPUs, GPUs, TPUs), and from desktops to clusters of servers to mobile and edge devices. Originally developed by researchers and engineers from the Google Brain team within Google’s AI organization, it comes with strong support for machine learning and deep learning and the flexible numerical computation core is used across many other scientific domains.

Importing Tensorflow

To use TensorFlow, we need to import the library called tensorflow. We imported it with the name "tf", so the modules can be accessed by tf.moduleName
import tensorflow as tf

Sessions

Sessions are contex for creating a graph inside tensorflow. The graphs need session for the computaion of the values
a = tf.constant(12)
b = tf.constant(13)
c = tf.multiply(12, 13)
with tf.Session() as session:
    print(session.run(c))
156

Matrix Multiplications

As we all know, most of the images are just matrix tables, matrix tables of pixel values. So, most of the computer vision task relies on matrix multiplications of the matrices.
matrixA = tf.constant([[3, 4], [4, 5]])
matrixB = tf.constant([[5, 6], [2, 3]])
matrixC = tf.matmul(matrixA, matrixB)

# Don't get confused with tf.multiply and tf.matmul as the first one does element wise multiplications 
# and the latter one gives the dot product of the two matrices
with tf.Session() as session:
    print(session.run(matrixC))
[[23 30]
 [30 39]]

Variables

A TensorFlow variable is the best way to represent shared, persistent state manipulated by your program. Variables are manipulated via the tf.Variable class. A tf.Variable represents a tensor whose value can be changed by running ops on it.
variableA = tf.Variable(0)
variableB = tf.constant(5)
activity1 = tf.assign(variableA, variableB)
with tf.Session() as session:
    # To be able to use variables in a computation graph it is necessary to initialize them before 
    # running the graph in a session.
    session.run(tf.global_variables_initializer())
    session.run(activity1)
    print(session.run(variableA))
5

Placeholders

A placeholder is simply a variable that we will assign data to at a later date. Unlike variables, the placeholders get's their data from outside of the computational graph.
placeholder1 = tf.placeholder(dtype=tf.float32)
with tf.Session() as session:
    print(session.run(placeholder1, feed_dict={placeholder1: 5}))
5.0
placeholder2 = tf.placeholder(dtype=tf.float32)
placeholder3 = tf.placeholder(dtype=tf.float32)
activity2 = tf.pow(placeholder2, placeholder3)
with tf.Session() as session:
    activity3 = session.run(activity2, feed_dict={placeholder2: 2, placeholder3: 3})
    print(activity3)
8.0

Thanks for completing this lesson!


##### Notebook created by: Sulabh Shrestha ##### Github: CodeExponent ##### Copyright © 2018 [CodeExponent]

Documentation


Contribute


Support


If you are having issues, please let us know. I have a mailing list located at: [email protected]

References


Copyright and License


Copyright 2018 Codexponent. Code released under the [MIT]license.