26 #ifndef CASADI_GRAPH_BUILDER_HPP
27 #define CASADI_GRAPH_BUILDER_HPP
29 #include "function.hpp"
33 class GraphBuilderInternal;
51 public SWIG_IF_ELSE(PrintableCommon, Printable<GraphBuilder>) {
54 std::string
type_name()
const {
return "GraphBuilder"; }
67 GraphBuilder(
const std::string& name,
const std::vector<uint8_t>& model_data,
68 const std::string& format,
const Dict& opts =
Dict());
72 const std::string&
name()
const;
81 std::vector<casadi_int>
dimension(
const std::string& name)
const;
83 std::string
dtype(
const std::string& name)
const;
93 void bind_dim(
const std::string& param, casadi_int value);
95 void bind_shape(
const std::string& input_name,
const std::vector<casadi_int>& shape);
97 void set(
const std::string& input_name,
const std::vector<double>& value);
99 void set(
const std::string& input_name,
double value);
112 const std::vector<std::string>& name_in,
113 const std::vector<std::string>& name_out,
137 GraphBuilderInternal* operator->();
138 const GraphBuilderInternal* operator->()
const;
139 GraphBuilderInternal* get()
const;
A mutable, format-neutral interface to a computational-graph model.
GraphBuilder()
Default constructor.
GraphBuilder(const Function &f, const Dict &opts=Dict())
Construct from a CasADi Function (export lifecycle)
std::string dtype(const std::string &name) const
Element type name of a tensor (input or output) by name (FLOAT, INT64, ...)
std::vector< casadi_int > dimension(const std::string &name) const
Declared shape of a tensor (input or output) by name; -1 for dynamic dimensions.
void set(const std::string &input_name, double value)
Bake a scalar value into an input.
void bind_dim(const std::string ¶m, casadi_int value)
Bind a symbolic/dynamic dimension to a concrete size.
std::vector< std::string > dynamic_params() const
Names of the symbolic/dynamic dimensions in the model.
const std::string & name() const
Name of the model.
Function create(const std::string &name, const std::vector< std::string > &name_in, const std::vector< std::string > &name_out, const Dict &opts=Dict()) const
Freeze into an evaluable Function.
casadi_int n_in() const
Declared shape of a tensor (input or output) by name; -1 for dynamic dimensions.
std::vector< std::string > dimension_param(const std::string &name) const
Per-axis symbolic dimension name of a tensor by name ("" for static axes)
std::string type_name() const
Readable name of the class.
std::vector< std::string > name_in() const
Declared shape of a tensor (input or output) by name; -1 for dynamic dimensions.
Function create() const
Freeze into an evaluable Function, default naming.
GraphBuilder(const std::string &model_path, const Dict &opts=Dict())
Construct from a model file (import lifecycle; format from the file suffix)
void set(const std::string &input_name, const std::vector< double > &value)
Bake a fixed value into an input; it is fed at create() and not exposed as a Function input.
void bind_shape(const std::string &input_name, const std::vector< casadi_int > &shape)
Pin the full shape of an input.
casadi_int n_out() const
Declared shape of a tensor (input or output) by name; -1 for dynamic dimensions.
std::vector< std::string > name_out() const
Declared shape of a tensor (input or output) by name; -1 for dynamic dimensions.
void export_onnx(const std::string &filename, const Dict &opts=Dict())
Export to an ONNX model file.
Function create(const std::string &name, const Dict &opts=Dict()) const
Freeze into an evaluable Function, exposing all model inputs and outputs.
GenericShared implements a reference counting framework similar for efficient and.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.