Hi I have a 2D array in an UnsafePointer.
For convenience I would like to use a LayoutTensor all wrapped in a struct:
Problem is that mutability is inferred only in LayoutTensor hence I cant declare the field.
Here is kind of what I am trying to do:
alias MyLayout = Layout.row_major(1024, 1024)
struct MyStruct:
var data: UnsafePointer[UInt32]
var tensor: LayoutTensor[DType.uint32, MyLayout] <--- This guy xD
fn __init__(out self):
self.data = UnsafePointer[UInt32].alloc(1024 * 1024)
self.tensor = LayoutTensor(self.data)
As someone how is trying to understand the Mojonic way to represent a 2D array (compile time size known)?