spatial-lang icon indicating copy to clipboard operation
spatial-lang copied to clipboard

API for reading binary data

Open shadjis opened this issue 7 years ago • 2 comments

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)

shadjis avatar Jun 08 '17 21:06 shadjis

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.

dkoeplin avatar Jul 08 '17 03:07 dkoeplin

Binary file reading is now added and confirmed working in Scala, but no support yet in C

dkoeplin avatar Jul 23 '17 23:07 dkoeplin