1 2 3 4 5 6import tensorflow as tf from tensorflow.python.eager import context with context.device('cpu:0'): # 此处写数据预处理代码,以下仅为示例 x = tf.Variable([1, 2, 3]) y = tf.square(x) 如果使用Python的多进