### Tensor Flow Tutorial

TensorFlow is a free and open-source software library specifically used for deep learning application development using ANN(Artificial Neural Network) and CNN(Convolutional Neuron Network). It is a symbolic math library, and is also used for machine learning applications.

In machine learning we've been working mainly with vectors (numpy arrays), and a tensor cans

be a vector. Most simply, a tensor is an array-like object, and, as you've seen, an array can hold your matrix, your vector, and really even a scalar.

TensorFlow works by first defining and describing our model in abstract, and then, when we are ready, we make it a reality in the session. The description of the model is what is known as your "Computation Graph" in TensorFlow terms.

##### How to install tensorflow:

There are many approaches to install tensorflow. Open anaconda command prompt and execute the following command:

conda install tensorflow==2.2 Also you can use Google Colab environment. Here I have used Google Colab environment.

There are three basic terminologies such as constant, place holder and variable that I have discussed which is as follows:

``````#import tensorflow
import tensorflow as tf
tf.compat.v1.disable_eager_execution()

print(tf.__version__)

Output: 2.2.0```
```

``````#Constant in tensorflow
con1=tf.constant(100)
con2=tf.constant(12.34)
con3=tf.constant('Python')
con4=tf.constant(True)
print([con1,con2,con3,con4])```
``` ``````#Create a Session
session=tf.compat.v1.Session()
session.run([con1,con2,con3,con4])
output: [100, 12.34, b'Python', True]

result1=tf.constant(200) + tf.constant(300)
result2=tf.constant(10) * tf.constant(20)
session.run([result1,result2])
output: [500, 200]```
```

``````addition=tf.constant([1,2,3,4,5]) + tf.constant([5,4,3,2,1])
multiplication=tf.constant([1,2,3,4,5]) * tf.constant([5,4,3,2,1])
output: [array([6, 6, 6, 6, 6], dtype=int32), array([5, 8, 9, 8, 5], dtype=int32)]

str1=tf.constant("SILAN")
str2=tf.constant("Software")
session.run(str1+str2)
Output: b'SILANSoftware'```
```

``````#Placeholder
a=tf.compat.v1.placeholder(tf.int32)
b=a*2
session.run(b,feed_dict={a:[1,2,3,4,5]})
array([ 2,  4,  6,  8, 10], dtype=int32)
str_name=tf.compat.v1.placeholder(tf.string)
my_name="I am"+str_name
session.run(my_name,feed_dict={str_name:["Sashi","Sneha"]})
output: array([b'I amsashi', b'I amsneha'], dtype=object)```
```

``````#Variable
var1=tf.compat.v1.Variable(,tf.int32)
init=tf.compat.v1.global_variables_initializer()
session.run(init)
session.run(var1)
output: array(, dtype=int32)
y=tf.compat.v1.assign(var1,)
session.run(y)

Output: array(, dtype=int32)```
```

``````#linear regression model
m=tf.compat.v1.Variable(,tf.int32)
c=tf.compat.v1.Variable(,tf.int32)
x=tf.compat.v1.placeholder(tf.int32)
linear_model=m*x+c
init1=tf.compat.v1.global_variables_initializer()
session.run(init1)
session.run(linear_model,feed_dict={x:[1,2,3,4,5]})

Output: array([15, 25, 35, 45, 55], dtype=int32)```
``` Silan Software

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc