I'll cut to the chase and get right to the code!
# All-0 and all-1 matrices v1 = (([3,3,3]), name="v1") v2 = (([10,5]), name="v2") #Populate single-valued matrices v3 = (([2,3], 9)) # Constant Matrix v4_1 = ([1, 2, 3, 4, 5, 6, 7]) v4_2 = (-1.0, shape=[2, 3]) # All-1 or all-0 matrices with the same shape as v4_1 v5_1=tf.ones_like(v4_1) v5_2=tf.zeros_like(v4_1) # Generate an isometric series v6_1 = (10.0, 12.0, 30, name="linspace")#float32 or float64 v7_1 = (10, 20, 3)#just int32 # Generate various randomized data matrices # Mean distribution v8_1 = (tf.random_uniform([2,4], minval=0.0, maxval=2.0, dtype=tf.float32, seed=1234, name="v8_1")) #Normal distribution v8_2 = (tf.random_normal([2,3], mean=0.0, stddev=1.0, dtype=tf.float32, seed=1234, name="v8_2")) #Normal distribution, but with the numbers outside of 2 sigma removed # v8_3 = (tf.truncated_normal([2,3], mean=0.0, stddev=1.0, dtype=tf.float32, seed=1234, name="v8_3")) # Rearrange the 3 rows v8_5 = tf.random_shuffle([[1,2,3],[4,5,6],[6,6,6]], seed=134, name="v8_5")
The above are all variables in the calculation chart, which need to be () before they become real data.
The access method is:
("",(v1))#numpy save v1 as file test_a = ("") print test_a[1,2]
This Tensorflow's common matrix generation method is all that I have shared with you, I hope to give you a reference, and I hope you will support me more.