#Vectors vs Tensors ?

5 messages · Page 1 of 1 (latest)

dense lion
#

Can some one explain the difference between Mojo Vectors [ Dynamic , InlinedFixed ] and Tesnors and when to use what ?. For example if i want to create a list like structure [ think a python like list ] what should i use ?? and why ? Are there benefits of using Tensors over Vectors and vise versa ?

dense snowBOT
#

Congrats @dense lion, you just advanced to level 2!

hard grove
#

Tensors can be multi-dimensional (but with a flat layout internally) and Vectors can't. Even if you can declare a vector of vector, it won't have a flat memory layout. I think tensors have special optimizations in mind, taking advantage of the flat internal structure.

dense lion
#

@hard grove thank you for the response. So for list like behaviour should one go for Vectors or Tensors ? whats your opinion on that ?

proud garden
#

dynamic vectors can be resized like a python list while tensors have a fixed shape so vectors are definitely more list-like