TensorFlow_Model_Questions_and_Answers
TensorFlow_Model_Questions_and_Answers
## **Basic Questions**
developers to build and train machine learning models. It supports deep learning, neural networks,
and other algorithms, and provides tools for building models, deploying them, and scaling
---
```bash
```
```bash
```
Ensure that your system meets the prerequisites, such as CUDA and cuDNN for GPU acceleration.
---
### 3. What are tensors, and how are they different from arrays?
- **Tensors**: Multi-dimensional arrays used as the fundamental data structure in TensorFlow. They
can represent scalars, vectors, matrices, or higher-dimensional data.
- **Difference**: Tensors are immutable and optimized for computation in TensorFlow, while arrays
---
```python
import tensorflow as tf
```
---
### 5. What is the difference between TensorFlow 1.x and TensorFlow 2.x?
- **Eager Execution**: TensorFlow 2.x enables eager execution by default, simplifying debugging
- **Keras Integration**: TensorFlow 2.x includes Keras as its default high-level API for building
models.
- **Simplified Syntax**: TensorFlow 2.x provides a cleaner and more Pythonic interface.
---
### 6. What are placeholders, constants, and variables in TensorFlow?
TensorFlow 2.x.
- **Constants**: Immutable tensors whose values cannot be changed once defined. Created using
`tf.constant`.
- **Variables**: Mutable tensors used to store weights or other parameters during training. Created
using `tf.Variable`.
---
```python
import tensorflow as tf
# Create a variable
initializer = tf.compat.v1.global_variables_initializer()
```
---
```python
import tensorflow as tf
model = Sequential([
Dense(1, activation='sigmoid')
])
```
---
The Sequential API is a high-level way to define neural networks in TensorFlow. It allows you to
```python
model = Sequential([
Dense(32, activation='relu'),
Dense(1, activation='sigmoid')
])
```
---
### 10. How do you compile a model in TensorFlow?
```python
model.compile(optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])
```
---
### 11. What are loss functions, and why are they important?
Loss functions quantify the difference between predicted values and actual values. They are crucial
---
### 12. What are optimizers, and how do they work in TensorFlow?
Optimizers adjust model weights to minimize the loss function. Common optimizers:
---
### 13. How do you train a TensorFlow model?
```python
```
---
### 14. What is the role of epochs, batch size, and iterations in training?
---