Vectors vs Tensors ?
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 ?
5 Replies
Congrats @shamal_de_silva, you just advanced to level 2!
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.
@duckki thank you for the response. So for list like behaviour should one go for Vectors or Tensors ? whats your opinion on that ?
dynamic vectors can be resized like a python list while tensors have a fixed shape so vectors are definitely more list-like
right so tensors can't dynamically change the size ! thank you very much for the clarrification @Ryulord :mojo: