A pratical programming Tensor concept #422
Answered
by
AIWithShrey
davidemicheletti
asked this question in
Q&A
Replies: 1 comment
-
That sounds about right, but the standard definition of a Tensor is that it
is a multidimensional array, which is extremely difficult to visualise when
the dimension is greater than 3.
Your example is a good representation of a multidimensional array. If I’m
not mistaken, tf.constant() is equivalent to numpy’s np.ndarray(), where n
represents the number of dimensions.
On Fri, Jul 29, 2022 at 2:08 PM davidemicheletti ***@***.***> wrote:
Thinking that i understand what a scalar, vector, and matrix are.
Is it correct to say that a tensor is a vector of matrices (or a matrix of
matrices)?
Going deeper, can we say that tensor's number of dimensions depends on how
many vectors are the "parent"?
Example
`
import tensorflow as tf
t_dim3 = tf.constant([ # 1st 'parent'
[[1, 2, 3],
[4, 5, 6]],
[[7, 8, 9],
[10, 11, 12]],
[[13, 14, 15],
[16, 17, 18]]
])
t_dim3.ndim # expected result is 3
t_dim4 = tf.constant([ # 1st 'parent'
[ # 2nd 'parent'
[[1, 2, 3],
[4, 5, 6]],
[[7, 8, 9],
[10, 11, 12]],
[[13, 14, 15],
[16, 17, 18]]
],[ # we can add child ofc
[[19, 20, 21],
[22, 23, 24]],
[[24, 25, 27],
[28, 29, 30]],
[[31, 32, 33],
[34, 35, 36]]
]
])
t_dim4.ndim # expected result is 4
`
—
Reply to this email directly, view it on GitHub
<#422>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF2IW5SQHBCJYSSPSL4KA63VWOJ7TANCNFSM5477B6GA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Warmest Regards,
Shreyas Mocherla
Student of Grade 12, Indus International School Hyderabad
Visit my page at shreyasm.com
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
davidemicheletti
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Thinking that I understand what a scalar, vector, and matrix are, or I think so :D .
Is it correct to say that a tensor that has more than 2 dimensions is a vector of matrices (or a matrix of matrices)?
Going deeper, can we say that tensor's number of dimensions depends on how many vectors are the "parent"?
Example
`
import tensorflow as tf
t_dim3 = tf.constant([ # 1st 'parent'
[[1, 2, 3],
[4, 5, 6]],
[[7, 8, 9],
[10, 11, 12]],
[[13, 14, 15],
[16, 17, 18]]
])
t_dim3.ndim # expected result is 3
t_dim4 = tf.constant([ # 1st 'parent'
[ # 2nd 'parent'
[[1, 2, 3],
[4, 5, 6]],
[[7, 8, 9],
[10, 11, 12]],
[[13, 14, 15],
[16, 17, 18]]
],[ # we can add child ofc
[[19, 20, 21],
[22, 23, 24]],
[[24, 25, 27],
[28, 29, 30]],
[[31, 32, 33],
[34, 35, 36]]
]
])
t_dim4.ndim # expected result is 4
`
Beta Was this translation helpful? Give feedback.
All reactions