Reading Tensor From File
Is anyone aware how the Tensor.fromfile() function works as explained in the mojo docs?
I've tried reading from txt and csv files as well as files generated by the Tensor.tofile() function but none of these seem to create a Tensor with any desired values.
4 Replies
I would assume it’s just writing a header with the metadata then just raw binary for the data, I think we did similar somewhere in <#1238547362012729355> , you won’t be able to read them without custom tools (or obviously tensor.from file)
Do you need to use a Tensor at all? I had some code that used Tensors, until I found that I could just use the FileHandle.read_bytes function. Here's my code...
Here's the code for converting from the raw data of
List[UInt8]
s to Strings...