Skip to content

String tensor vs utf8 encoding #422

Open
@sir-earl

Description

@sir-earl

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions