M
Modular3w ago
Firas

shift right/left in max graphs custom ops

first of all I want to say it's haarddd to learn mojo/max !! I am struggling !! hope it will be worth it... I have the following new custom simple op in max graph. for now it's dummy and just do or between two input booleans. from max.extensibility import Tensor, empty_tensor from max import register @register.op("my_rule") #fn automata_rule[type: DType, rank: Int](values: Tensor[type, rank], rules: Tensor[DType.uint8, rank]) -> Tensor[type, rank]: fn rule[type: DType, rank: Int](values: Tensor[type, rank], values_2: Tensor[type, rank]) -> Tensor[type, rank]:
var output = empty_tensortype
@always_inline @parameter fn func[width: Int](i: StaticIntTuple[rank]) -> SIMD[type, width]:
var val = values.simd_loadwidth var val_2 = values_2.simd_loadwidth return val & val_2 output.for_eachfunc return output^ I want to just slice the inputs, that means if I have input [1,2,3,4,5] I want to make it [2,3,4,5] and another one to make it [1,2,3,4] How can I do it ?? The docs is documented but htere is no examples there and it's hard for symbolic graph it;s not regular python indexing !!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server