# Advanced Interview Questions on TensorFlow

Get this book -> Problems on Array: For Interviews and Competitive Programming

In this article, we have presented **advanced interview questions on TensorFlow** with multiple options to choose from. Select an answer to find out if you got it right and get explanation for the answer.

This will help you get prepared for tough Interviews on TensorFlow, Google's Machine Learning framework.

## Which datatype is not supported in TensorFlow as of v2.5.0?

FP8

FP32

INT8

INT32

FP8 (Floating point, 8 bits) is not supported in TensorFlow as of v2.5.0. Over 30 datatypes are supported in TensorFlow including INT8, INT32, UINT8 and many others. It has been proposed to include FP8 in later versions.

## Can we add a new operation in TensorFlow without modifying the source code?

Yes

No

Depends on operations

Depends on datatype

A new operation can be added in TensorFlow without modifying the source code. The implementation of the new op should be in C++ and it should be registered. The instructions to do this is at: tensorflow.org/guide/create_op

## Intel's OneDNN is officially supported in TensorFlow as an optimized version. Which environment variable is used to enable logs in this version?

MKLDNN_VERBOSE

ONEDNN_VERBOSE

ONEDNN_LOGS

MKLDNN_LOGS

Setting the environment variable MKLDNN_VERBOSE to 1

Consider the following error:

```
AttributeError: module 'tensorflow' has no attribute 'GraphDef'
```

## If we get the above error, what might be the issue?

Using wrong TF version

Using wrong API

Corrupted TF build

Error in graph optimization

It mentions that tensorflow module does not have the attribute GraphDef. This is because GraphDef was removed in later versions of TensorFlow that is following v2.x. You need to have experience porting code from TFv1.x to TFv2.x to understand this.

## What is the additional attribute that is stored by SavedModel compared to Checkpoints in TensorFlow?

Serialized description of computation

Number of operations

Value of different variables

Description of links between ops

SavedModel has serialized description of the computation in addition to a Checkpoint. Checkpoint only has the saved value of different variables. When it comes to save a pre-trained graph, then we have two options in TensorFlow: Checkpoint and SavedModel.

## What of the following is not a valid file extension of a Checkpoint file in TensorFlow?

ckpt.value

ckpt.data

ckpt.meta

ckpt.index

The file extension of a Checkout file is .ckpt. It can have different files which can have extensions like ckpt.meta, ckpt.data and ckpt.index. There is no extension like ckpt.value.

## What does "Pin to host optimizer" in TensorFlow graph optimizations do?

Swaps small operations onto CPU

Scoped allocators to reduce data movement

Automatically parallelizes graphs

Optimizes function library

"Pin to host optimizer" is a TensorFlow graph optimizations. It swaps small operations onto the CPU and is turned off by default.

## In the function tf.nn.conv2d of TensorFlow, what is the dimension of the parameter "filters"?

4

2

1

Any value

Filters in the operation tf.nn.conv2d is a 4 dimensional tensor. The dimensions are: filter_height, filter_width, in_channels and out_channels.

## In the operation tf.nn.avg_pool3d, what is the data type of the input is supported?

NDHWC

NHWC

NCHW

NCHWc8

In TensorFlow, the operation tf.nn.avg_pool3d supports only two data formats namely: NDHWC and NCDHW.

## Which operation in TensorFlow is used for bitwise AND operation between two tensors?

tf.bitwise.bitwise_and

tf.bitwise.and

tf.add

tf.bitwise_and

tf.bitwise.bitwise_and() is the operation in TensorFlow which is used for bitwise AND operation between two tensors of any datatype (DType) supported by TensorFlow.

## There are two operations in TensorFlow for 2D Convolution namely tf.nn.conv2d and tf.raw_ops.Conv2D. Which attribute is additional in tf.raw_ops.Conv2D?

use_cudnn_on_gpu

dilations

padding

data_format

tf.raw_ops.Conv2D has two additional attributes namely use_cudnn_on_gpu and explicit_paddings. Operations in tf.raw_ops provide access to low level functions in TensorFlow.

With these questions at OpenGenus, you must have had a strong test of your advanced TensorFlow skills. Enjoy.