bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
torch_distribution.h
Go to the documentation of this file.
1#ifndef TORCH_DISTRIBUTION_H
2#define TORCH_DISTRIBUTION_H
3
4#include "bitrl/base/bitrl_config.h"
5
6#ifdef USE_PYTORCH
7
9#include "torch/torch.h"
10
11#include <vector>
12
13namespace bitrl
14{
15namespace maths
16{
17namespace stats
18{
19
25{
26
27 public:
31 virtual ~TorchDistributionBase() = default;
32
36 virtual torch_tensor_t entropy() const = 0;
37
44
48 virtual torch_tensor_t sample(c10::ArrayRef<int64_t> sample_shape) = 0;
49
50 protected:
55
59 std::vector<int64_t> batch_shape_;
60
64 std::vector<int64_t> event_shape_;
65
71 std::vector<int64_t> extended_shape(c10::ArrayRef<int64_t> sample_shape);
72};
73
74} // namespace stats
75} // namespace maths
76} // namespace bitrl
77#endif
78#endif // TORCH_DISTRIBUTION_H
std::vector< int64_t > batch_shape_
batch_shape_
Definition torch_distribution.h:59
virtual torch_tensor_t sample(c10::ArrayRef< int64_t > sample_shape)=0
Ssample. Sample from the distribution.
virtual torch_tensor_t log_prob(torch_tensor_t value)=0
log_prob
virtual ~TorchDistributionBase()=default
Destructor.
std::vector< int64_t > event_shape_
event_shape_
Definition torch_distribution.h:64
std::vector< int64_t > extended_shape(c10::ArrayRef< int64_t > sample_shape)
extended_shape
virtual torch_tensor_t entropy() const =0
entropy
Definition torch_bernoulli_dist.h:23
Definition lp_metric.h:10
Various utilities used when working with RL problems.
Definition bitrl_log.h:25
torch::Tensor torch_tensor_t
torch_tensor_t
Definition bitrl_types.h:95