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.imag([-1.2+3.4j, 5.6-7.89j, 0.1+46.49j]) ss= tf.Session(config=config) print(ss.run(a))