TensorFlow Questions et reponses d'entretien
Differences associees
Question 26. What is eager execution and how is it enabled in TensorFlow?
Eager execution allows operations to be executed immediately as they are called, similar to regular Python code. It can be enabled in TensorFlow 2.x by default, or explicitly using tf.compat.v1.enable_eager_execution().
Example:
Question 27. Explain the purpose of the tf.keras.layers.Embedding layer.
The Embedding layer is used for word embeddings in natural language processing tasks. It maps integer indices (representing words) to dense vectors, allowing the model to learn semantic relationships between words.
Example:
Question 28. How can you save and load a TensorFlow model?
A TensorFlow model can be saved using the tf.keras.models.save_model method. It can be loaded using the tf.keras.models.load_model method for further use or deployment.
Example:
loaded_model = tf.keras.models.load_model('saved_model.h5')
Question 29. Explain the purpose of the tf.config.experimental.list_physical_devices method.
tf.config.experimental.list_physical_devices is used to list all available physical devices (CPUs, GPUs) in the TensorFlow environment. It can be helpful for configuring distributed training or checking available hardware.
Example:
Question 30. What is the purpose of the tf.data.Dataset.cache method in TensorFlow?
The cache method in tf.data.Dataset is used to cache elements in memory or on disk, improving the performance of dataset iteration by avoiding redundant data loading.
Example:
Les plus utiles selon les utilisateurs :