TensorFlow : Check Here To Know More!

Safalta Expert Published by: Saksham Chauhan Updated Wed, 14 Sep 2022 12:55 AM IST

Highlights

Check TensorFlow Here At Safalta.com

A free software library called TensorFlow exists. Although TensorFlow was initially created by researchers and engineers working on the Google Brain Team within Google's Machine Intelligence research organisation for the purposes of conducting machine learning and deep neural networks research, the system is sufficiently general to be applicable in a wide range of other domains as well. Download these FREE Ebooks:
1. Introduction to Digital Marketing
2. Website Planning and Creation

What Is TensorFlow?

TensorFlow is essentially a software package that uses data flow graphs to compute numerically in the following ways:
  • The graph's nodes correspond to mathematical operations.
  • The multidimensional data arrays (referred to as tensors) transferred between the nodes of the network are represented by its edges. (Note that the primary unit of data in TensorFlow is the tensor.)\

TensorFlow APIs

TensorFlow has several APIs (Application Programming Interfaces).

Source: Safalta.com

These may be divided into two main groups:

1. A simple API
  • total control over the programming
  • suggested for researchers in machine learning
  • gives the models a high degree of control.
  • The low level TensorFlow API is called TensorFlow Core.
2. Advanced API:
  • built atop TensorFlow Core
  • more ease of use and learning than TensorFlow Core
  • simplify and standardise repetitive processes for consumers across numerous platforms.
  • A high level API is one like tf.contrib.learn.

TensorFlow Core

1.

Free Demo Classes

Register here for Free Demo Classes

Please fill the name
Please enter only 10 digit mobile number
Please select course
Please fill the email
Installing TensorFlow

You can find a simple installation tutorial for TensorFlow here:
TensorFlow installation.

Running the following command in the Python interpreter after installation will confirm a successful installation:
 

import tensorflow as tf

2. The Computational Graph

There are two distinct portions that may be found in any TensorFlow Core programme:

  • A computational graph is nothing more than a collection of TensorFlow operations organised into a graph of nodes.
  • Running the computational graph. We must run the computational graph within a session in order to really analyse the nodes. The control and state of the TensorFlow runtime are contained in a session.

Output:

Sum of node1 and node2 is: 8

Variables

Variable nodes, which may carry variable data, are also included in TensorFlow. They are mostly used to store and update training model parameter information. Tensor-containing in-memory buffers serve as variables. They can be stored to disc during and after training, but they must be manually initialised. Later, when you want to test or evaluate the model, you may restore stored settings. A crucial distinction between a constant and a variable is that:

Anywhere the graph is loaded, the value of a constant is reproduced since it is stored in the graph. A variable may reside on a parameter server and is saved independently.

Given below is an example using Variable:

Output:

Tensor value before addition:
 [[ 0.
                                                                                                                                                                                                    
                                                                                                                                                    
                                     0.]
 [ 0.
                                                                                                                                                                                                    
                                                                                                                                                    
                                     0.]]
Tensor value after addition:
 [[ 1.
                                                                                                                                                                                                    
                                                                                                                                                    
                                     1.]
 [ 1.
                                                                                                                                                                                                    
                                                                                                                                                    
                                     1.]]

In above program:

  • We create a variable type node and give it a starting value..
    node = tf.Variable(tf.zeros([2,2]))
    
  • The variable node in the scope of the current session is initialised by:
    sess.run(tf.global_variables_initializer())
    
  • We may use the assign method to give a variable node a new value in the following way:
           node = node.assign(node + tf.ones([2,2]))

Placeholders

Consider the example given below:

 

Output:

[[3 6 9]
 [2 4 6]
 [1 2 3]]




 

 

Free E Books