You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy the Tensor with elements cast to the new type.
However when I do this the metadata of the tensor seems to still be that of the old tensor type.
The values in the tensor themselves are fine, but when looking at the bytecount and tensorspec are called the new tensor seems to think it is still the old tensor.
Steps to reproduce
Minimal example:
from tensor import Tensor, rand
var tensor_uint8 = rand[DType.uint8](3, 3)
print("8 bit tensor byte count: ", tensor_uint8.bytecount())
var tensor_float32 = tensor_uint8.astype[DType.float32]()
print("32 bit tensor byte count: ", tensor_float32.bytecount())
print("")
print("8 bit tensor spec: ", tensor_uint8.spec())
print("32 bit tensor spec: ", tensor_float32.spec())
Yeilds:
8 bit tensor byte count: 9
32 bit tensor byte count: 9
8 bit tensor spec: 3x3xuint8
32 bit tensor spec: 3x3xuint8
System information
What OS did you do install Mojo on ? Ubuntu 22.04.4 LTS
Provide version information for Mojo by pasting the output of mojo -v mojo 24.3.0 (9882e19d)
Provide Modular CLI version by pasting the output of modular -v modular 0.7.2 (d0adc668)
The text was updated successfully, but these errors were encountered:
Bug description
Hey, I have run into something odd with Tensors.
The tensor
astype()
method: https://docs.modular.com/mojo/stdlib/tensor/tensor/Tensor#astypeSays:
However when I do this the metadata of the tensor seems to still be that of the old tensor type.
The values in the tensor themselves are fine, but when looking at the
bytecount
andtensorspec
are called the new tensor seems to think it is still the old tensor.Steps to reproduce
Minimal example:
Yeilds:
System information
Ubuntu 22.04.4 LTS
mojo -v
mojo 24.3.0 (9882e19d)
modular -v
modular 0.7.2 (d0adc668)
The text was updated successfully, but these errors were encountered: