Monday, 17 December 2018

Specifying CPUs for use in Keras Tensorflow Model Inference

Alright. I know that we can limit the number of cores used by a Keras (TF backend) model by using the following method:

 K.set_session(K.tf.Session(config=K.tf.ConfigProto(intra_op_parallelism_threads=2, inter_op_parallelism_threads=2,  device_count = {'CPU': 2})))

And we can specify individual tensor operations like this:

with tf.device('/cpu:0'):
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')

But what if we want to specify a list of individual CPUs to be used by the Keras model?



from Specifying CPUs for use in Keras Tensorflow Model Inference

No comments:

Post a Comment