You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
everything has this API of running a session and the return value is the output tensors, but in C, it returns an OrtStatusPtr
but I am lost as to how to achieve this in C so that I can write a wrapper around it for Zig... How can I retrieve the outputs of running a session in C? Thank you.
here are other examples of similar languages that all have a similar API:
let outputs:Vec<Value> = {letmut inputs = vec![Value::from_array(session.allocator(),&phoneme_inputs).unwrap(),Value::from_array(session.allocator(),&input_lengths).unwrap(),Value::from_array(session.allocator(),&scales).unwrap(),];ifletSome(ref sid_tensor) = speaker_id {
inputs.push(Value::from_array(session.allocator(), sid_tensor).unwrap());}match session.run(inputs){Ok(out) => out,Err(e) => {returnErr(PiperError::OperationError(format!("Failed to run model inference. Error: {}",
e
)))}}};
my code in Zig:
pubfnrun(self: *Self) !void {
// this is just directly calling the C api hereconststatus=self.ort_api.Run.?(
self.session,
self.run_opts,
self.input_names.ptr,
self.ort_inputs.?.ptr,
self.ort_inputs.?.len,
self.output_names.ptr,
self.output_names.len,
self.ort_outputs.?.ptr,
);
trycheckError(self.ort_api, status);
}
I would guess that 'output' would be something that I pass into this function and that would be filled with the output, but I have no idea what that is supposed to look like and I'm having trouble finding any information or real world examples of this. If this is the case, I have no idea how I would know the length of the output tensor, either.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here is an example of what I'm trying to translate to C:
everything has this API of running a session and the return value is the output tensors, but in C, it returns an
OrtStatusPtr
but I am lost as to how to achieve this in C so that I can write a wrapper around it for Zig... How can I retrieve the outputs of running a session in C? Thank you.
here are other examples of similar languages that all have a similar API:
my code in Zig:
I would guess that 'output' would be something that I pass into this function and that would be filled with the output, but I have no idea what that is supposed to look like and I'm having trouble finding any information or real world examples of this. If this is the case, I have no idea how I would know the length of the output tensor, either.
Beta Was this translation helpful? Give feedback.
All reactions