autograph
autograph copied to clipboard
[question] how to convert BufferBase to Vec
Hi, I use the network defined in https://github.com/charles-r-earp/autograph/blob/main/examples/neural-network-mnist/src/main.rs The output of the model in inference as_raw_slice() is F32(BufferBase { device: Device(0), len: 14190, elem: "f32" }). Now I try to get a Vec<32> of it to interpret the results. Can you help me to understand how to get the data?
Here is a peace of code:
autograph=v0.1.1
let prediction = self
.net
.clone()
.into_device(device)
.await
.unwrap()
.infer(&x)
.unwrap();
let prediction: FloatBuffer = prediction
.as_raw_slice()
.into_device(Device::host())
.await
.unwrap();
println!("{:?}", prediction);
// F32(BufferBase { device: Host, len: 14190, elem: "f32" })
Some examples show to "read" data back: let output = y.read().await?;
But FloatBuffer does not have the read() function.