9 namespace Experimental {
11 inline std::vector<Ort::Value>
Session::Run(
const std::vector<std::string>& input_names,
const std::vector<Ort::Value>& input_values,
12 const std::vector<std::string>& output_names,
const RunOptions& run_options) {
14 std::vector<Ort::Value> output_values;
15 for (
size_t i = 0; i < output_names_count; i++) output_values.emplace_back(
nullptr);
16 Run(input_names, input_values, output_names, output_values, run_options);
20 inline void Session::Run(
const std::vector<std::string>& input_names,
const std::vector<Ort::Value>& input_values,
21 const std::vector<std::string>& output_names, std::vector<Ort::Value>& output_values,
const RunOptions& run_options) {
22 size_t input_names_count = input_names.size();
23 size_t output_names_count = output_names.size();
24 std::vector<const char*> input_names_(input_names_count,
nullptr);
26 for (
auto it = input_names.begin(); it != input_names.end(); it++) input_names_[i++] = (*it).c_str();
27 std::vector<const char*> output_names_(output_names_count,
nullptr);
29 for (
auto it = output_names.begin(); it != output_names.end(); it++) output_names_[i++] = (*it).c_str();
30 Ort::Session::Run(run_options, input_names_.data(), input_values.data(), input_names_count, output_names_.data(), output_values.data(), output_names_count);
36 std::vector<std::string> out(node_count);
37 for (
size_t i = 0; i < node_count; i++) {
47 std::vector<std::string> out(node_count);
48 for (
size_t i = 0; i < node_count; i++) {
58 std::vector<std::string> out(init_count);
59 for (
size_t i = 0; i < init_count; i++) {
68 std::vector<std::vector<int64_t>> out(node_count);
75 std::vector<std::vector<int64_t>> out(node_count);
82 std::vector<std::vector<int64_t>> out(init_count);
AllocatedStringPtr GetOverridableInitializerNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of the overridable initializer name at then specified index.
size_t GetInputCount() const
Returns the number of model inputs.
std::vector< std::vector< int64_t > > GetInputShapes() const
TypeInfo GetInputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetInputTypeInfo.
static MemoryInfo CreateCpu(OrtAllocatorType type, OrtMemType mem_type1)
AllocatedStringPtr GetOutputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of output name at then specified index.
std::vector< std::vector< int64_t > > GetOverridableInitializerShapes() const
std::vector< Value > Run(const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, size_t output_count)
Run the model returning results in an Ort allocated vector.
static Ort::Value CreateTensor(T *p_data, size_t p_data_element_count, const std::vector< int64_t > &shape)
std::vector< std::string > GetInputNames() const
std::vector< Ort::Value > Run(const std::vector< std::string > &input_names, const std::vector< Ort::Value > &input_values, const std::vector< std::string > &output_names, const RunOptions &run_options=RunOptions())
std::vector< int64_t > GetShape() const
Uses GetDimensionsCount & GetDimensions to return a std::vector of the shape.
Wrapper around OrtMemoryInfo.
std::vector< std::string > GetOutputNames() const
static Value CreateTensor(const OrtMemoryInfo *info, T *p_data, size_t p_data_element_count, const int64_t *shape, size_t shape_len)
Creates a tensor with a user supplied buffer. Wraps OrtApi::CreateTensorWithDataAsOrtValue.
std::vector< std::vector< int64_t > > GetOutputShapes() const
std::vector< std::string > GetOverridableInitializerNames() const
TypeInfo GetOutputTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOutputTypeInfo.
ConstTensorTypeAndShapeInfo GetTensorTypeAndShapeInfo() const
Wraps OrtApi::CastTypeInfoToTensorInfo.
TypeInfo GetOverridableInitializerTypeInfo(size_t index) const
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
size_t GetOverridableInitializerCount() const
Returns the number of inputs that have defaults that can be overridden.
size_t GetOutputCount() const
Returns the number of model outputs.
AllocatedStringPtr GetInputNameAllocated(size_t index, OrtAllocator *allocator) const
Returns a copy of input name at the specified index.
Wrapper around ::OrtAllocator default instance that is owned by Onnxruntime.