TensorFlow is a popular framework of machine learning and deep learning. It is a free and open source library. It is a develop by Google Brain in 9 November 2015. The latest version of TensorFlow, name TensorFlow 2.0 in September 2019.

TensorFlow logo
TensoeFlow

TensorFlow is derive from two Greek word Tensor and Flow.

  • Tensor : Tensor is a multidimensional array is knows as Tensor
  • Flow :-  flow of data in operation is knows as flow.

The TensorFlow provides is multiple API (Application Programming Interfaces). These are classified into 2 major types.

  • Low level API
  • High level API

Advantages of TensorFlow

  •  It has platform flexibility.
  • It is easily trainable on CPU as well as GPU.
  •  It is support for threads, asynchronous computation, and queues.
  •  It is a customizable
  • It is a open source.
  • TensorFlow is highly parallel and design to use various backends software.

Disadvantages of TensorFlow 

  • It is no support for OpenCL and Windows.
  • It is a  no GPU support.
  • TensorFlow lacks behind in the speed.

Syntax

tf.constant(value, dtype, name = ” “)

TensorFlow Functions

  • tensorflow.add(a, b)
  • tensorflow.substract(a, b)
  • tensorflow.multiply(a, b)
  • tensorflow.div(a, b)
  • tensorflow.pow(a, b)
  • tensorflow.exp(a)
  • tensorflow.sqrt(a)

Some example of TensorFlow function

import tensorflow as tf    

x = tf.constant([2.0], dtype = tf.float32)  

tensor_c = tf.constant([[3,4]], dtype = tf.int32)  

tensor_v = tf.constant([[5, 6]], dtype = tf.int32)    

print(tf.sqrt(x))    

print(tf.exp(x))   

print(tf.pow(x,x))  

tensor_add = tf.add(tensor_c, tensor_v)  

print(tensor_add)  

tensor_sub = tf.subtract(tensor_c, tensor_v)  

print(tensor_sub)   

tensor_mul = tf.multiply(tensor_c, tensor_v)  

print(tensor_mul)  

tensor_div = tf.div(tensor_c, tensor_v)  

print(tensor_div)  

Tensorflow Architecture

  • TensorFlow Servables
  • TensorFlow Servables Versions
  • TensorFlow Servables Streams
  • TensorFlow Models
  • TensorFlow Loaders 
  • TensorFlow Managers
  • TensorFlow Core
  • Sources in Tensorflow Architecture 
  • TensorFlow Batcher

Tensor Attributes

tensorflow.shape

Example of tensorflow.shape

import tensorflow as tf  

p_shape = tf.constant([ [20, 21],  

                        [22, 23],  

                        [24, 55] ]                        

                     )   

p_shape.shape 

Output

TensorShape([Dimension(3), Dimension(2)]) 

tensorflow.zeros

Example of tensorflow.zeros

import tensorflow as tf   

print(tf.zeros(22))  

Output

Tensor(“zeros:0”, shape=(22,), dtype=float32) 

tensorflow.ones

Example of tensorflow.ones

import tensorflow as tf  

print(tf.ones([10, 10]))              

print(tf.ones(m_shape.shape[0]))  

print(tf.ones(m_shape.shape[1]))  

print(tf.ones(m_shape.shape))

Output

Tensor(“ones_1:0”, shape=(10, 10), dtype=float32) Tensor(“ones_2:0”, shape=(3,), dtype=float32) Tensor(“ones_3:0”, shape=(2,), dtype=float32) Tensor(“ones_4:0”, shape=(3, 2), dtype=float32) 

tensorflow.dtype

Example of tensorflow.dtype

import tensorflow as tf  

p_shape = tf.constant([ [21, 22],  

                        [23, 24],  

                        [25, 26] ]                        

                     )   

print(p_shape.dtype)

Output

<dtype: ‘int32’>

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about tensorFlow please Wikipedia Click here

Stay Connected Stay Safe, Thank you.

Categories: Software

Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *