shamal_de_silva
shamal_de_silva
MModular
Created by shamal_de_silva on 1/11/2024 in #questions
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 ?
6 replies
MModular
Created by shamal_de_silva on 1/10/2024 in #questions
How to read the Mojo documentation effectively
Am in the process of learning mojo and i want to know how to read the documenation effectively. For the most part the documentation is quite straight forward. , but ive come across some sections that trip me up. For example when going through the section on collections we have Dynamic vectors , and underneath dynamic vectore we have the description of the data structure and then the methods associated with it. Now to create a dynamic vector the syntax is var vect = DynamicVectordata type . the constructor details are as follows
__init__(inout self: Self, capacity: Int)
Constructs a vector with the specified capacity.
Args:
capacity (Int): The requested capacity of the vector.
__init__(inout self: Self, capacity: Int)
Constructs a vector with the specified capacity.
Args:
capacity (Int): The requested capacity of the vector.
Given this constructor information, I'm trying to figure out how the syntax var vect = DynamicVectordata type is derived from it. How can I interpret this constructor documentation to understand the syntax for initializing a DynamicVector.
5 replies