7 : config(config), client(host, name, headers),
8 ModPiece(read_input_size(host, name, headers), read_output_size(host, name, headers))
27 throw std::runtime_error(
"Model does not support evaluation!");
28 std::vector<std::vector<double>> inputs_stdvec(this->
numInputs);
29 for (
int i = 0; i < this->
numInputs; i++) {
30 inputs_stdvec[i] = EigenvectordToStdVector(inputs[i]);
41 Eigen::VectorXd
const& sens) {
51 Eigen::VectorXd
const& vec){
62 Eigen::VectorXd
const& sens,
63 Eigen::VectorXd
const& vec){
Provides an abstract interface for defining vector-valued model components.
virtual Eigen::VectorXd GradientByFD(unsigned int const outputDimWrt, unsigned int const inputDimWrt, std::vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &sensitivity)
virtual Eigen::VectorXd ApplyHessianByFD(unsigned int const outWrt, unsigned int const inWrt1, unsigned int const inWrt2, std::vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &sens, Eigen::VectorXd const &vec)
Eigen::MatrixXd ApplyJacobianByFD(unsigned int outWrt, unsigned int inWrt, Args const &... args)
std::vector< Eigen::VectorXd > outputs
Eigen::VectorXd hessAction
Eigen::VectorXd jacobianAction
void GradientImpl(unsigned int outWrt, unsigned int inWrt, muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs, Eigen::VectorXd const &sens) override
Eigen::VectorXi read_input_size(const std::string host, std::string name, const httplib::Headers &headers)
static Eigen::VectorXd StdVectorToEigenvectord(std::vector< double > &vector)
UMBridgeModPiece(const std::string host, std::string name, json config=json(), httplib::Headers headers=httplib::Headers())
Construct UMBridgeModPiece, connecting to model server.
void ApplyJacobianImpl(unsigned int outWrt, unsigned int inWrt, muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs, Eigen::VectorXd const &vec) override
void EvaluateImpl(muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs) override
umbridge::HTTPModel client
void ApplyHessianImpl(unsigned int outWrt, unsigned int inWrt1, unsigned int inWrt2, muq::Modeling::ref_vector< Eigen::VectorXd > const &inputs, Eigen::VectorXd const &sens, Eigen::VectorXd const &vec) override
Eigen::VectorXi read_output_size(const std::string host, std::string name, const httplib::Headers &headers)
static Eigen::VectorXi StdVectorToEigenvectori(const std::vector< std::size_t > &vector)
int numOutputs
The number of outputs.
std::string name
A unique name for this WorkPiece. Defaults to <ClassName>_<id>
int numInputs
The number of inputs.
a class to store JSON values
bool SupportsApplyHessian() override
bool SupportsEvaluate() override
bool SupportsGradient() override
bool SupportsApplyJacobian() override
std::vector< std::vector< double > > Evaluate(const std::vector< std::vector< double >> &inputs, json config_json=json()) override
std::vector< std::size_t > GetOutputSizes(const json &config_json=json()) const override
std::vector< double > Gradient(unsigned int outWrt, unsigned int inWrt, const std::vector< std::vector< double >> &inputs, const std::vector< double > &sens, json config_json=json()) override
std::vector< double > ApplyHessian(unsigned int outWrt, unsigned int inWrt1, unsigned int inWrt2, const std::vector< std::vector< double >> &inputs, const std::vector< double > &sens, const std::vector< double > &vec, json config_json=json()) override
std::vector< double > ApplyJacobian(unsigned int outWrt, unsigned int inWrt, const std::vector< std::vector< double >> &inputs, const std::vector< double > &vec, json config_json=json()) override
std::vector< std::size_t > GetInputSizes(const json &config_json=json()) const override
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...