TensorFlow Interview Questions

TensorFlow Interview Questions
Download TensorFlow Interview Questions PDF

Below are the list of Best TensorFlow Interview Questions and Answers

TensorFlow is a platform where one can learn machine learning / deep learning/multilayer neural networks from the Google library. Libraries that use data science are helpful to describe complex networks in a very easy and understandable manner.

Owing to its high versatility it can be used for a variety of different prototypes ranging from research level to real products. Machine learning is used by researchers, programmers and data scientists. The goal is to provide the same set of the toolset to help collaborations for improving efficiency.

TensorFlow is one of the most famous and widely used deep learning library these days. It is developed to fill the gap between researchers and product developers. It is easy to deploy in scale and can work in the cloud and mobile devices such as iOS and Android.

Below are major features of TensorFlow:

  • TensorFlow has the biggest ability is to build neural networks using which machines can develop logical thinking and learning analogous to humans.
  • It is one of the best libraries when it comes to deep learning that can describe some basic calculation processing also.
  • It can be used for all sorts of processing like pre-processing, calculation, state, data loading, output.
  • There is also Define and Run which first builds calculation processing via a graph and then collects the calculation processing also.
  • Adding to these, TensorFlow can be used to spread learning in Android as well as iOS.

Tensors can be thought of as vectors and matrices of higher dimensions. They represent n-dimensional arrays of base data-type. Each element of a tensor is of the same data-type which is always known.

However, the shape i.e. the number of dimensions and the size of each dimension might only be known partially. Although in most of cases the shape of the tensor is known, but in some cases, it is only possible to know the shape at the graph execution.

There are many types of tensors available some of them are.

  • tf.constant
  • tf.placeholder
  • tf.SparseTensor
  • tf.Variable

All of these are immutable except for tf.Variable .

TensorFlow is used for the Classification, Understanding, Perception, Prediction, Discovering, and Creation. It is widely used in the field of

  • Voice recognition
  • Image detection
  • Video detection
  • Text-based applications
  • Time series
  • Sentiment analysis

The various Software requirements for installing the TensorFlow 2 are as follows -

  • Ubuntu 16.04 or later (64-bit)
  • 64-bit Windows 7 or later series of Windows (Only for Python 3 )
  • Raspbian 9.0 or later series of it
  • pip 19.0 or later series of it (requires Linux 2010 support)
  • macOS 10.12.6 (Sierra) or later (64-bit) (no GPU support)

A few major differences between the Keras, Tensor flow and PyTorch are as follows

S. No.Criteria of classificationKerasTensorFlowPyTorch
1.Based on platformKeras is an open source platform for deep learning and neural network building that is designed to run over TensorFlowThe TensorFlow is an open-source library designed for dataflow programming.The PyTorch is an open source machine learning library designed for Python, which is based on Torch.
2.Based on APIThe Keras is designed with a high level of API and designed to run on top of TensorFlow and the PyTorch.The TensorFlow is designed to provide both high and low APIs.The PyTorch generally. operates with lower APIs.
3.Based on the ArchitectureBased on the readability and ease of use Keras is the best.The TensorFlow is at the middle level in between the Keras and the PyTorch on the basis of architecture.The PyTorch comes at the lowest level based on the ease of usage and readability.
4.Based on Debugging criteriaThe Keras, very less requires debugging.TensorFlow is at the middle level in between the PyTorch and the Keras based on Debugging criteria.The PyTorch has the best debugging facilities amongst the three

TensorFlow.js is a framework that is designed to run and define computations using Javascript as the language. It is used for training and developing Machine learning models using Javascript.

It provides two things in terms of different levels of APIs- the core API which is designed to deal with a low level of code and the Layer API which increases the level of abstraction.

In the TensorFlow, Loaders are used to add algorithms as well as data backend. TensorFlow itself is one of the data back ends. It can be implemented and programmed to load, access and unload an altogether new prototype of a servable ML model.

An activation function is a function that is applied to the output of any neural layer and is then passed on to the next later as input which is known as an activation layer. It is a key part of the TensorFlow as it provides the non-linearity which is required to prevent the neural network from reducing to a mere logistic regression. The most popular activation function which is also widely used is the Rectification Linear Unit.

The Servable is one of the center attractions that helps to wrap the TensorFlow objects. It is an underlying object which is used by clients to perform operations and computations such as inference. Servable focus on the interference aspect on the interference aspect of the ML projects in a production and distributed environment. The size is key as, smaller the servable faster the load time.

ROC or receiver operating characteristics are the graphical representation of the diagnostic ability of a binary classifier system when the discrimination threshold is varied. It is a true positive rate v/s the false positive rate curve which is plotted for various threshold settings. It serves the purpose of analyzing the connection/trade-off between clinical sensitivity and specificity for a set of every possible cut-off.

The major differences between RNN and CNN are as follows

S. No.CriteriaRNNCNN
1Full formThe RNN stands for Recurrent Neutral Networks.The CNN stands for Convolution Neutral Networks.
2.Based upon the  suitabilityThe RNN is best suited for temporal data, also called as the sequential data.This is best used for processing of images, classification of images and to correlate data.
3.Based on compatibility featuresThe feature compatibility of RNN is lesser.The CNN feature compatibility is more.
4.Based on handling input/ outputThe RNN is able to handle arbitrary input/output lengths.The CNN is able to handle only fixed input/output lengths.
5.Based on processingThe RNN is able to use internal memory to process arbitrary sequences of inputs.CNN is a feed-forward artificial neural network.

TensorFlow has a lot to offer. But one must be aware of all the pros and cons.

The advantages of using TensorFlow are as follows-

  • Graphs
  • Library Management
  • Debugging
  • Scalability
  • Pipelining

Even though it might seem as TensorFlow is an all-in-all application, here are some disadvantages of it which are worth considering-

  • Missing Symbolic Loops
  • No support for Windows
  • No GPU is supported other than conventional NVidia and only language support is available.
  • Computation Speed

There are a lot of dashboards in TensorFlow. These are required to serve various purposes ranging from measurement and visualization to hyperparameter tuning. They are used to visualize the TensorFlow graphs. Some of them are-

  • Scalar Dashboard
  • Histogram
  • Distribution Dashboard
  • Image Dashboard
  • Audio Dashboard
  • Graph Explorer
  • Projector
  • Text Dashboard

Bias variables are used by artificial neural networks to better match functions with a y-intercept other than zero. The advantage is that there is no need to train the bias variables for a certain set of common problems.

A graph defines computation and the execution of this graph or part of graphs is done by a Session. A session allocates resources on a single variable or in some cases more than one variable for that graph and holds the intermediate variables and results.

There is a list of different commands available in python to check the version of TensorFlow. Some of them are-

python -c 'import tensor flow as tf; print(tf.__version__)'  //For python2
python3 -c 'import tensor flow as tf; print(tf.__version__)'  //For python3

The initialization of weights is done in a random manner as this is critical for learning good mapping based on input and output in neural networks. This is necessary as the search space involving the weights is a large one and since there are multiple low minimums, the back-propagation might be trapped.

TensorFlow provides techniques to minimize the complexity of optimizing inference. Model quantization is used for reduced precision and representations of weights and also, in some cases, activations for storage and computation. It has several benefits to the users -

  • Supporting the exquisite CPU platforms.
  • SIMD instruction capabilities are provided.

The Placeholders in TensorFlow are used to feed data into the graph. Placeholder serves the purpose of creating operations and building a computation graph without actually needing the graph. It is a variable to which data is assigned to a later date.

The major differences between Variables and Placeholders are

S. No.CriteriaVariablesPlaceholders
1.Based on UsageVariables are used to store the present as well as the past state of a graph.Placeholders are used to feed external data into a graph and the data is assigned to a later date.
2.Based on declaration commandTo declare a variable we use the tf.Variable() command.To declare a placeholder tf.placeholder() command.
3.Based on the requirement of initializationThe variables are needed to be initialized before running the graph.Initialization is not required in the case of the placeholders.

The Tensor board is a tool provided by TensorFlow to help measure and visualize the needed dimensions during machine learning overflow. It enables tracking and analyzing the accuracy, projecting embedding to a lower-dimensional space, helping visualize the graph and much more. It is used for analysis and inspection of TensorFlow runs and graphs using a suite of web applications.