Skip to content
Discussion options

You must be logged in to vote

It was already answered on discord but will provide an example here for future reference. You can use Data::new with Shape to create a new tensor.

For example, you can convert an image vector to tensor:

// Here img_vec is a Vec<u8> for an image with shape 224x224x3
Tensor::<B, 3>::from_data(Data::new(img_vec, Shape::new(224, 224, 3)).convert(), device)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@canxin121
Comment options

@laggui
Comment options

Answer selected by antimora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants