import tensorflow as tf import multiprocessing as mp core_num = mp.cpu_count() config = tf.ConfigProto( inter_op_parallelism_threads=core_num, intra_op_parallelism_threads=core_num ) a = tf.unique([1, 2, 4, 8, 12, 1, 4, 12, 16]) ss= tf.Session(config=config) print(ss.run(a))