bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
pytorch_optimizer_factory.h
Go to the documentation of this file.
1#ifndef PYTORCH_OPTIMIZER_FACTORY_H
2#define PYTORCH_OPTIMIZER_FACTORY_H
3
4#include "bitrl/base/bitrl_config.h"
5
6#ifdef USE_PYTORCH
7
9#include <any>
10#include <map>
11#include <memory>
12#include <string>
13#include <torch/torch.h>
14
15#ifdef BITRL_DEBUG
16#include <cassert>
17#endif
18
19namespace bitrl
20{
21namespace maths
22{
23namespace optim
24{
25namespace pytorch
26{
27
31std::unique_ptr<torch::optim::OptimizerOptions>
32build_pytorch_optimizer_options(OptimizerType type, const std::map<std::string, std::any> &options);
33
39std::unique_ptr<torch::optim::Optimizer>
40build_pytorch_optimizer(OptimizerType type, torch::nn::Module &model,
41 const torch::optim::OptimizerOptions &options);
42
48std::unique_ptr<torch::optim::Optimizer>
49build_pytorch_optimizer(OptimizerType type, torch::nn::Module &model,
50 std::unique_ptr<torch::optim::OptimizerOptions> &options)
51{
52 return build_pytorch_optimizer(type, model, *options.get());
53}
54
55} // namespace pytorch
56} // namespace optim
57} // namespace maths
58} // namespace bitrl
59#endif
60#endif // PYTORCH_OPTIMIZER_FACTORY_H
Definition pytorch_optimizer_factory.h:26
std::unique_ptr< torch::optim::OptimizerOptions > build_pytorch_optimizer_options(OptimizerType type, const std::map< std::string, std::any > &options)
std::unique_ptr< torch::optim::Optimizer > build_pytorch_optimizer(OptimizerType type, torch::nn::Module &model, const torch::optim::OptimizerOptions &options)
build_pytorch_optimizer
Definition optimizer_type.h:12
OptimizerType
The RenderModeType enum.
Definition optimizer_type.h:20
Definition lp_metric.h:10
Various utilities used when working with RL problems.
Definition bitrl_log.h:25