The tensor constructor doesn’t accept the ‘bytes’ data type, so when I read raw image data from a file, I wind up going through numpy frombuffer just to get it into an acceptable format.
frameBytes = rgbFile.read(frameSize)
frameTensor = torch.tensor(np.frombuffer(frameBytes, dtype=np.uint8), device=dev)
Is there a better way to do this, or should torch.tensor() get modified to accept bytes as a uint8 data source?