用一个自定义的数组初始化tensorflow variable

import tensorflow as tf
tf.enable_eager_execution()

value = [0, 1, 2, 3, 4, 5, 6, 7]
init = tf.constant_initializer(value)
x = tf.get_variable('x', shape=[8], initializer=init)
print(x)

打印结果:

你可能感兴趣的:(TensorFlow)