import tensorflow as tf # 使用tf.constant来创建一个张量矩阵 a1 = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3]) print(a1) print(tf.shape(a1)) tf.random.random_normal(shape,mean=0.0) tf.random_normal_initializer(shape,mean=0.0,stddev=1.0,dtype=tf.float32,seed=None,name=None) tf.random_uniform_initializer(shape,minval=0,maxval=None,dtype=tf.float32,seed=None,name=None) tf.truncated_random_normal_initializer(shape,mean=0.0,stddev=1.0,dtype=tf.float32,seed=None,name=None)