I'm trying to use raw_ops::decode_image to load an image directly from a u8 slice (as opposed to from file as per the example), but it seems I must first convert the slice to a scalar tensor string.
It appears I can make this work with something like:
let s = unsafe { String::from_utf8_unchecked(image_bytes.to_vec()) };
My concern is that Rust expects all strings to be utf8 encoded, of which the above certainly is not.
Am I missing something obvious? Is there a better way to approach this?
I'm trying to use
raw_ops::decode_imageto load an image directly from au8slice (as opposed to from file as per the example), but it seems I must first convert the slice to a scalar tensor string.It appears I can make this work with something like:
let s = unsafe { String::from_utf8_unchecked(image_bytes.to_vec()) };My concern is that Rust expects all strings to be
utf8encoded, of which the above certainly is not.Am I missing something obvious? Is there a better way to approach this?