tensorflow 基本語法

數據定義

常量

c_1 = tf.constant(4)
c_2 = tf.constant([4,3,2])

變量

v_1 = tf.Variable( rand_t )

張量

t_1 = tf.random_normal( [2,3] , mean =2.0, stddev=4 , seed =12 )
t_2 = tf.truncated_normal([1,5] , stddev=2 )
t_3 = tf.random_uniform([2,3] , maxval=4 , seed=12 )

 tf.random_crop( t_random,[2,5] , seed=12)

tf.random_shuffle( t_random )
tf.set_random_seed(54)

其他

c_3 = tf.zeros([2,3] , tf.int32 )
c_4 = tf.ones([2,3] , tf.int32)
c_5 = tf.linspace( 2.0 , 5.0 , 5 ) 
c_6 = tf.range(10)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章