Skip to content

[Documentation] I/O Binding Needs Detail #23682

@axbycc-mark

Description

@axbycc-mark

Describe the documentation issue

The I/O Binding page doesn't seem to show how to get the output tensors when the MemoryInfo output binding is used.

Here is the relevant code snippet.

  Ort::Env env;
  Ort::Session session(env, model_path, session_options);
  Ort::IoBinding io_binding{session};
  auto input_tensor = Ort::Value::CreateTensor<float>(memory_info, input_tensor_values.data(), input_tensor_size, input_node_dims.data(), 4);
  io_binding.BindInput("input1", input_tensor);
  Ort::MemoryInfo output_mem_info{"Cuda", OrtDeviceAllocator, 0,
                                  OrtMemTypeDefault};
  // Use this to bind output to a device when the shape is not known in advance. If the shape is known you can use the other overload of this function that takes an Ort::Value as input (IoBinding::BindOutput(const char* name, const Value& value)).
  // This internally calls the BindOutputToDevice C API.

  io_binding.BindOutput("output1", output_mem_info);
  session.Run(run_options, io_binding);

I'm a little confused what to do next to actually get "output1."

Page / URL

https://onnxruntime.ai/docs/performance/tune-performance/iobinding.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationimprovements or additions to documentation; typically submitted using templatestaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions