what is permutate argument 28perm 29 in tf transpose 3f

Solutions on MaxInterview for what is permutate argument 28perm 29 in tf transpose 3f by the best coders in the world

showing results for - "what is permutate argument 28perm 29 in tf transpose 3f"
Charlotte
22 Jul 2019
1x = tf.constant([[[ 1, 2, 3], 
2                    [ 4, 5, 6]], 
3                   [[ 7, 8, 9], 
4                    [ 10, 11, 12]], 
5                   [[ 13, 14, 15], 
6                    [ 16, 17, 18]], 
7                   [[ 19, 20, 21], 
8                    [ 22, 23, 24]]]) 
9transposed_tensor = tf.transpose(x, perm = [2,1,0]) 
10# if you run x.shape
11x.shape
12>>>TensorShape([4, 2, 3])
13# if you run transpose.shape
14transpose.shape
15>>>TensorShape([3,2,4])
16# now change the perm argument of tf.transpose to perm = [0,1,2]
17transpose.shape
18>>>TensorShape([4,2,3])
19## now change the perm argument of tf.transpose to perm = [1,2,0]
20transpose.shape
21>>>TensorShape([2,3,4])
22# that means if we consider the output of tensor as a list then we thought
23# list of perm argument as a index-list of shape of input array.so,if we change
24# the value of list in perm we see the corresponding change of input array shape
25# as output of transpose shape