Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

MACHINE LEARNING

TENSORFLOW IN MACHINE LEARNING

Assignment - 2

Submitted by,

Ashmi P

Roll no-03

ME-CSE
TensorFlow is an end-to-end open source platform for machine learning.
TensorFlow is a rich system for managing all aspects of a machine learning
system; however, this class focuses on using a particular TensorFlow API to
develop and train machine learning models. See the TensorFlow documentation for
complete details on the broader TensorFlow system.

TensorFlow APIs are arranged hierarchically, with the high-level APIs built on the
low-level APIs. Machine learning researchers use the low-level APIs to create and
explore new machine learning algorithms. In this class, you will use a high-level
API named tf.keras to define and train machine learning models and to make
predictions. tf.keras is the TensorFlow variant of the open-source Keras API.

TensorFlow is an open-source software library for numerical computation using


data flow graphs. Nodes in the graph represent mathematical operations, while the
graph edges represent the multidimensional data arrays (tensors) that flow between
them. This flexible architecture allows you to deploy computation to one or more
CPUs or GPUs in a distributed manner.

TensorFlow was originally developed by researchers and engineers working on the


Google Brain project, and the name is a portmanteau of the words "tensor" and
"flow". It has since become a popular choice for machine learning, and is used by
researchers and engineers at Google, Facebook, Twitter, and other companies.

TensorFlow is available for Python, C++, and Java, and can be used to train and
deploy machine learning models on a variety of platforms, including desktops,
laptops, servers, and mobile devices.

Here are some of the benefits of using TensorFlow for machine learning:

​ Flexibility:
​ TensorFlow's flexible architecture allows you to deploy computation to one or
more CPUs or GPUs in a distributed manner. This makes it a good choice for
training and deploying large-scale machine learning models.
​ Scalability:
​ TensorFlow is designed to scale to large datasets and models. It can be used to
train and deploy models on a variety of platforms, including desktops, laptops,
servers, and mobile devices.
​ Performance:
​ TensorFlow is optimized for performance, and can be used to train and deploy
machine learning models quickly and efficiently.
​ Open source:
​ TensorFlow is an open-source software library, which means that it is free to use
and modify. This makes it a good choice for researchers and engineers who want
to develop and deploy custom machine learning models.

Here, add is a node which represents addition operation. a and b are input tensors
and c is the resultant tensor. This flexible architecture allows you to deploy
computation to one or more CPUs or GPUs in a desktop, server, or mobile device
with a single API!
Computational Graph
Any TensorFlow Core program can be divided into two discrete sections:
● Building the computational graph. A computational graph is nothing but
a series of TensorFlow operations arranged into a graph of nodes.
● Running the computational graph. To actually evaluate the nodes, we
must run the computational graph within a session. A session
encapsulates the control and state of the TensorFlow runtime.

node1 = tf.constant(3, dtype=tf.int32)


node2 = tf.constant(5, dtype=tf.int32)
● node3 is of tf.add type. It takes two tensors as input and returns their
sum as output tensor.

node3 = tf.add(node1, node2)


● Step 2 : Run the computational graph In order to run the
computational graph, we need to create a session. To create a session, we
simply do:

TensorFlow has Variable nodes too which can hold variable data. They are mainly
used to hold and update parameters of a training model. Variables are in-memory
buffers containing tensors. They must be explicitly initialized and can be saved to
disk during and after training. You can later restore saved values to exercise or
analyze the model. An important difference to note between a constant and
Variable is:

You might also like