Please explain the difference between Vector, Scalar and Matrix #261
-
Hiya everyone, So i was watching a youtube video from Daniele Bourke. It's really amazing for starters looking to learn and know about AI and Deep Learning but i came across a confusion with the below. Ideally, a scalar is 0 dimension tensor, a vector is a 1 dimension and a matrix is a 2 dimension tensor. But when i do the below code, i get the same dimensions for all of them. import tensorflow as tf matrix = tf.constant([[[10,10],[10,10]],[[7,7],[7,7]],[[8,8],[8,8]]]) matrix.ndim gives 3 vector = tf.constant([[[10,10],[10,10]],[[7,7],[7,7]],[[8,8],[8,8]]]) vector.ndim also gives 3 Then what is the difference between them? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, @Cutesurd. You are creating two equal objects with different names. When you assign variables |
Beta Was this translation helpful? Give feedback.
Hi, @Cutesurd. You are creating two equal objects with different names.
When you assign variables
matrix =
andvector =
, these are just names of your choice, but doesn't make a difference on what it contains. The content for both istf.constant([[[10,10],[10,10]],[[7,7],[7,7]],[[8,8],[8,8]]])
, and that is a tensor with 3 dims.