spatial-lang
spatial-lang copied to clipboard
API for reading binary data
It would be nice to have a function similar to numpy.fromfile, e.g.
ReadTensor(file_path, datatype, dims)
Where the file is in binary format, e.g. 4 byte float, 1 byte uint8, etc.
I can make a separate issue but it would also be nice to have a DecodeJPEG function which takes a file path e.g. something equivalent to the following Scala
import javax.imageio.ImageIO
val photo1 = ImageIO.read(new File("photo.jpg"))
printf("Photo size is %d x %d\n, photo1.getWidth, photo1.getHeight)
These seem like good additions to the existing file read support - working on them now.
Reading arbitrary data from binary file is a bit annoying, but I'll definitely have something for numeric types soon.
Binary file reading is now added and confirmed working in Scala, but no support yet in C