TensorFlow/fr: Difference between revisions

Jump to navigation Jump to search
Updating to match new version of source page
No edit summary
(Updating to match new version of source page)
Line 311: Line 311:


Le fichier texte sera remplacé par le bon lien symbolique.
Le fichier texte sera remplacé par le bon lien symbolique.
==Controlling the number of CPUs and threads==
===TensorFlow 1.x===
The config parameters <code>device_count</code>, <code>intra_op_parallelism_threads</code> and <code>inter_op_parallelism_threads</code> influence the number of threads used by TensorFlow. You can set those parameters when instantiating a session:
tf.Session(config=tf.ConfigProto(device_count={'CPU': num_cpus}, intra_op_parallelism_threads=num_intra_threads, inter_op_parallelism_threads=num_inter_threads))
For example, if you want to run multiple instances of TF in parallel on a single node, you might want to reduce those values, potentially down to <code>1</code>.
===TensorFlow 2.x===
Sessions are not used anymore in TF 2.x, so here is the approach for configuring threads:
tf.config.threading.set_inter_op_parallelism_threads(num_threads)
tf.config.threading.set_intra_op_parallelism_threads(num_threads)
As of TF 2.1, there does not seem to be a way to set a CPU count.
38,907

edits

Navigation menu