Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

String tensor vs utf8 encoding #422

@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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions