zverianskii
zverianskii
MModular
Created by zverianskii on 12/6/2023 in #questions
What is the performance impact of interop with python
I want to use pytorch to train model on gpu and mojo for cpu (mojo to prepare data -> pytorch to train and predict-> loop). Any tips on efficiency?
2 replies
MModular
Created by zverianskii on 9/22/2023 in #questions
Any examples of algorithm.reduction.argmax usage?
I am writing fast where function, and from description argwhere looks like a good candidate but can't figure out how to use it. For example what is OutputChainPtr? @always_inline fn where(self, val: Int8, vec: DTypePointer[DType.int8]): @parameter fn w[nelts : Int](i : Int): var res = (self.values.simd_load[nelts](i) == val) #algorithm.reduction.argmax algorithm.vectorize[nelts, w](ar_size*ar_size)
7 replies
MModular
Created by zverianskii on 9/15/2023 in #questions
memory leak with DynamicVector
What is the right way to avoid memory leaks? From docs we see that DynamicVector doesn’t call elements destructors. Decorators supposed to create destructor but as far as I can tell you can’t use it manually. So what is the proper way to clean up in the and of the each step in the cycle? from utils.vector import DynamicVector # decorators supposed to create __del__? @value @register_passable("trivial") struct Point: var row: Int var col: Int var val: Int8 fn main(): for i in range(1000000): var vec = DynamicVector[Point](1000) for j in range(1000): vec.push_back(Point(0,0,0)) # this code doesn’t compile: # for j in range(1000): # vec[j].__del__()
23 replies
MModular
Created by zverianskii on 9/14/2023 in #questions
string chars to uint8
Any examples on how to access string characters and convert them to something similar to python bytes? In general any examples of types conversion would be helpful
12 replies