clarkezone
clarkezone
MModular
Created by clarkezone on 12/15/2023 in #questions
Difference between Float32 and DType.float32
I don’t have a ton of experience with python or AI/ML and so trying to figure out this basic questions in the comments around the difference / similarity between Float32 and DType.float32 more context in this snippet:
let dtp = DTypePointer[DType.float32]().alloc(10)
let p = Pointer[Float32].alloc(10)
for i in range(10):
let fi = Float32(i)
p[i] = fi

# is a Dtype.float32 same as a Float32 in terms of memory layout?
# what is the difference between DType.float32 and Float32?
dtp[i] = fi

# how do you create a DType.float32?
# let fi2 = DType[DType.float32](i)
# let dtp[i] = fi2
let dtp = DTypePointer[DType.float32]().alloc(10)
let p = Pointer[Float32].alloc(10)
for i in range(10):
let fi = Float32(i)
p[i] = fi

# is a Dtype.float32 same as a Float32 in terms of memory layout?
# what is the difference between DType.float32 and Float32?
dtp[i] = fi

# how do you create a DType.float32?
# let fi2 = DType[DType.float32](i)
# let dtp[i] = fi2
7 replies