TensorFlow Interview Questions
A list of top frequently asked TensorFlow Interview Questions and Answers are given below.
1) What is TensorFlow?
TensorFlow is a Python-based library which is used for creating machine learning applications. It is a low-level toolkit to perform complex mathematics. It offers users the customizability option to build experimental learning architectures. It also helps the users to work with them, and to turn them into running software. It was initially created by researchers and engineers working on the Google Brain Team, and It became open source in 2015.
TensorFlow is made up of two words Tensor and Flow; a tensor is known as data representation for multi-dimensional array and flow means a series of operations performed on tensors.
2) What do you know about Tensors?
The Tensor is a generalization of vectors or matrices of the n-dimensional array which is used in computer programming. It represents a multitude of data in the form of numbers. There are few other n-dimensional array libraries which are available on the internet such as Numpy, but TensorFlow stands apart from those libraries. It provides methods to create tensor functions and automatically compute derivatives.
A graph can conduct all operations in the Tensor. We can say that the edge of the node is known as Tensor. We need a feature vector as the initial input to implement a Tensor. The models are fed with the list of objects in the machine learning, and these objects are called feature vectors.
We can understand the Tensors with the help of the diagram given below:
Here, the arrow represents multi-dimensions. There is a Tensor which is known as stress, and it describes things happening in two directions.
3) How many types of Tensors are there?
There are three types of Tensors used to create neural network models:
4) Explain TensorBoard?
TensorBoard is a suite of visualizing tools for inspecting and understanding TensorFlow runs and graphs. It is an easy solution to Tensorflow offered by the creators that let us visualize the graphs. It plots quantitative metrics about the graph with additional data like images to pass through it.TensorBoard currently supports five visualizations techniques such as scalars, images, audio, histograms, and graphs. It improves the accuracy and flow of graphs.
5) What is the main feature of TensorFlow?
6) What are the advantages of TensorFlow?
Some of the main advantages of TensorFlow are given below:
7) List a few limitations of Tensorflow.
TensorFlow has some limitations, as mentioned here:
8) Which client languages are supported in TensorFlow?
TensorFlow provides support for multiple client languages, one of the best among them is Python. There are some experimental interfaces which are available for C++, Java, and Go. A language bindings for many other languages such as C#, Julia, Ruby, and Scala are created and supported by the open-source community.
9) What are the three working components of TensorFlow Architecture?
TensorFlow architecture works in three parts:
10) Explain few options to load data into TensorFlow.
Loading the data into TensorFlow is the first step before training a machine learning algorithm. There are two ways to load the data:
11) Describe the common steps to most TensorFlow algorithms?
12) Mention the name of some methods to deal with the overfitting in TensorFlow.
13) What do you know about TensorFlow Managers?
The TensorFlow managers are responsible for loading, unloading, lookup, and lifetime management of all servable objects via their loaders. TensorFlow Managers control the full lifecycle of Servables, including:
It is an abstract class. Its syntax is:
14) What are TensorFlow servables? Also, explain TensorFlow Serving.
The clients use some objects to perform the computations, and these objects are known as Servables. The size of the servable is flexible. A single servable might contain anything from a lookup table to a single model to a tuple of inference models. These servables are the central rudimentary units in TensorFlow Serving.
TensorFlow Serving is designed for production environments. It is a flexible, high-performance serving system used for machine learning models. TensorFlow Serving easily deploys new algorithms and experiments while keeping the same server architecture and APIs. TensorFlow Serving provides out-of-the-box integration with TensorFlow models. It can also be easily extended to serve other types of models and data whenever required.
15) What are the use cases of TensorFlow?
Tensorflow is an essential tool for deep learning. It has mainly five use cases, they are:
16) Where can you run a TensorFlow?
TensorFlow can run on different platforms:
17) When will you find overfit condition of a model in TensorFlow?
There are variations in the training data, and this data needs to be verified through TensorFlow. Overfitting can be probably seen if the variations are huge in the data. The best possible solution is to remove the noise from the available data upto the possible extent.
18) What are the loaders of TensorFlow?
The loader can be implemented to load, unload, and access a new type of servable machine learning model. These loaders are used for adding algorithms and data on the backend. The function load() is used to load the model from the saved model.
19) List some products that are built using TensorFlow.
There are a few products built using TensorFlow:
20) What are the sources in TensorFlow?
Sources are that type of modules which identify and provide servables. Each source provides zero or many servable streams. A single loader is supplied for each servable version makes it accessible so that it can be loaded.
21) What are the benefits of TensorFlow over other libraries? Explain.
There are many benefits of TensorFlow over other libraries which are given below:
22) What do you understand by Deep Speech?
DeepSpeech is an open-source engine used to convert Speech into Text. It uses a model which is trained by machine learning techniques. It is based on Baidu's Deep Speech research paper. It uses Google's TensorFlow to make the implementation easier.
We can list the command line options through deep Speech, and the syntax for that is given below:
23) What do you know about TensorFlow abstractions?
TensorFlow contains abstraction libraries such as TF-Slim and kereas, which provides simplified high-level access to TensorFlow. Such abstractions help to streamline the construction of data flow graphs.
TensorFlow abstractions not only help to make the code cleaner but also reduce the length of codes drastically. As a result, it significantly reduces development time.
24) How does TensorFlow use Python API?
Python is the primary language when it comes to TensorFlow and its development. It is the first and most recognizable language supported by TensorFlow and still supporting most of the features. It seems like the functionality of TensorFlow was initially defined in Python and later moved to C++.
25) What are the APIs used inside the TensorFlow project?
Most of the APIs inside TensorFlow are based on Python language. They have low-level options for the users such as tf.manual or tf.nn.relu used to build Neural Network Architecture. These APIs are also used to design a deep neural network having higher levels of abstraction.
26) What are the APIs used outside the TensorFlow project?
There are a few APIs used outside the TensorFlow project, which are:
27) How do we create tensors from Python objects?
We can create tensors such as numpy arrays and lists with the help of Python objects. We can easily perform it using tf.convert_to_tensor() operation.
28) What are the variables in TensorFlow?
Variables in TensorFlow are also known as tensor objects. These objects hold the values which can be modified during the execution of the program.
A TensorFlow variable is the best way which is used to represent a shared, persistent state manipulated by the program.
29) What is the lifetime of a variable?
A variable is created when we first run the tf.Variable.initializer operation for that variable in a session. It gets destroyed when tf.Session.close is processed.
30) Differentiate between tf.variable and tf.placeholder.
The tf.variable and tf.placeholder both are almost similar to each other, but there are some differences as following:
31) What is Scalar Dashboard?
Scaler Dashboard visualizes scaler statistics that vary over time. It uses a simple API for performing such visualizations. For example, We might want to examine the model's loss or learning rate.
We can compare multiple runs, and the data is established by tag.
32) What is a Histogram Dashboard?
The Histogram Dashboard is used to display how the statistical distribution of a Tensor varies overtime. It helps to visualize the data recorded via tf.summary.histogram. Each chart displays the temporal "slices" of data, where each slice is a histogram of the tensor at a given step. It is arranged with the oldest timestep in the back, and the most recent timestep in front.
If a Histogram mode is changed from "offset" to "overlay", the perspective will rotate. As a result, every histogram slice is rendered as a line and overlaid with one another.
33) What do you know about Distribution Dashboard in TensorFlow?
The Distribution Dashboard is another way that is used to visualize histogram data from tf.summary.histogram. It displays some high-level statistics on a distribution. Each line on the chart is used to represent a percentile in the distribution over the data. For example, the bottom line displays how the minimum value changes over time and the line in the middle displays how the median changes. Reading it from top to bottom, the lines provide the following meaning: [maximum, 93%, 84%, 69%, 50%, 31%, 16%, 7%, minimum].
34) What is Image Dashboard in TensorBoard?
The Image Dashboard is used to display png files that were saved via a tf.summary.image. The dashboard is configured in such a way so that each row corresponds to a different tag, and each column corresponds to a run. The image dashboard also supports arbitrary pngs which can be used to embed custom visualizations (e.g.,matplotlib scatterplots) into TensorBoard. This dashboard always shows the latest image for each tag.
35) What do you know about Audio Dashboard?
The Audio Dashboard is used to embed playable audio widgets for audio stored via a tf.summary.audio. The dashboard is configured so that each row corresponds to a different tag, and each column corresponds to a run. The Audio dashboard always embeds the latest audio for each tag.
36) Describe Graph Explorer in TensorFlow?
The Graph Explorer can be used while visualizing a TensorBoard graph. It is also responsible for enabling inspection of the TensorFlow model. To get the best use of the graph visualizer, one should use name scopes to group the ops in a graph hierarchically. Otherwise, the graph may be challenging to decipher.
37) What is Embedding Projector?
The Embedding Projector allows visualizing high-dimensional data. For example, one can view input data after it has been embedded in a high- dimensional space by model. The embedding projector reads data from the model checkpoint file. It may be configured with additional metadata, like a vocabulary file or sprite images.
38) What do you understand by Text Dashboard?
The Text Dashboard is used to display text snippets stored via tf.summary.text. Other features, such as hyperlinks, lists, and tables, are also supported.
39) Can I run TensorBoard without TensorFlow?
If you do not have TensorFlow installed then, TensorBoard 1.14+ can be run but with a reduced feature set. The primary limitation is that as of TensorFlow 1.14, only the following plugins are supported: scalars, custom scalars, image, audio, graph, projector (partial), distributions, histograms, text, PR curves, mesh. Also, there is no support for log directories on Google Cloud Storage.
40) What are the different dashboards in TensorFlow?
There are different types of dashboards in TensorBoard which perform various tasks in the tensor board:
41) What is the main operation in TensorFlow?
The main operation in TensorFlow is defined as passing values and assigning the output to another tensor.
42) What is more important to you between the performance and accuracy of a model, in machine learning based on TensorFlow?
It usually depends on the complete performance. Both performance and accuracy, weigh equal, although accuracy is prominent in most of the models.
43) Can TensorFlow be deployed in container software?
TensorFlow can be used with containerization tools such as Docker. It can be helpful to deploy a sentiment analysis model which uses character level ConvNet networks for text classification.
44) How can someone report a vulnerability in TensorFlow?
A person can report about any security issue directly to email@example.com. The report to this email is delivered to the security team at TensorFlow. The emails are then acknowledged within 24 hours, and detailed response is provided within a week along with the next steps.
45) What are the components used for deploying a lite model file in TensorFlow?
46) What are the differences between TensorFlow and PyTorch?
47) Can word embedding be used in TensorFlow? Name two models used in word embedding?
Word embedding is used in Natural Language Processing as a representation of words, and they can be used in TensorFlow where it is also known as Word2vec.
The two models used in word embedding are - The continuous bag of words model and the skip-gram model.
48) What do you understand by TensorFlow Estimators?
Estimators is a high-level API which reduces much of the code you previously needed to write while training a TensorFlow model. Estimators are very flexible, and it allows to override the default behavior if there is any specific requirement for the model.
There are two possible ways of building a model using Estimators:
49) What are some statistical distribution functions provided by TensorFlow?
A wide variety of statistical distributions is available which is provided by TensorFlow and located inside:
It contains distributions like Beta, Bernoulli, Chi2, Dirichlet, Gamma, Uniform, etc. These are important building blocks when it comes to building machine learning algorithms, especially for probabilistic approaches like Bayesian models.
50) What is the difference between Tensor.eval() and Session.run()?
In TensorFlow, we create graphs and provide values to that graph. The graph itself processes all the hardwork and generates the output based on the configuration that we have applied in the graph. Now, when we provide values to the graph, then first, we need to create a TensorFlow session.
Once the session is initialized, then we are supposed to use that session. It is necessary because all the variables and settings are now part of the session.
So, there are two possible ways that we can apply to pass external values to the graph so that the graph accepts them.
At the place of values.eval(), we can put tf.get_default_session().run(values) and It will provide the same behavior. Here, eval is using the default session and then executing run().