bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
pytorch_policy_network::TorchCategorical Class Referencefinal

#include <torch_categorical.h>

Inheritance diagram for pytorch_policy_network::TorchCategorical:
Collaboration diagram for pytorch_policy_network::TorchCategorical:

Public Member Functions

 TorchCategorical ()=default
 Default constructor.
 TorchCategorical (torch_tensor_t probs, bool do_build_from_logits=false)
 Build the categorical distribution from given torch_tensor_t of probabilities. if the flag build_from_logits, then the given tensor is assumed to represent logits.
 ~TorchCategorical () override=default
 ~TorchCategorical. Destructor
virtual torch_tensor_t entropy () const override
 entropy
virtual torch_tensor_t log_prob (torch_tensor_t value) override
 log_prob
virtual torch_tensor_t sample (c10::ArrayRef< int64_t > sample_shape={}) override
 Ssample. Sample from the distribution.
void build_from_logits (torch_tensor_t logits)
 build the distribution form logits
void build_from_probabilities (torch_tensor_t probs)
 build the distribution from probabilities
torch_tensor_t get_logits () const
 get_logits
torch_tensor_t get_probs () const
 get_probs
Public Member Functions inherited from bitrl::maths::stats::TorchDistributionBase
virtual ~TorchDistributionBase ()=default
 Destructor.

Additional Inherited Members

Protected Member Functions inherited from bitrl::maths::stats::TorchDistributionBase
 TorchDistributionBase ()=default
 Constructor.
std::vector< int64_t > extended_shape (c10::ArrayRef< int64_t > sample_shape)
 extended_shape
Protected Attributes inherited from bitrl::maths::stats::TorchDistributionBase
std::vector< int64_t > batch_shape_
 batch_shape_
std::vector< int64_t > event_shape_
 event_shape_

Constructor & Destructor Documentation

◆ TorchCategorical() [1/2]

◆ TorchCategorical() [2/2]

bitrl::maths::stats::TorchCategorical::TorchCategorical ( torch_tensor_t probs,
bool do_build_from_logits = false )

Build the categorical distribution from given torch_tensor_t of probabilities. if the flag build_from_logits, then the given tensor is assumed to represent logits.

◆ ~TorchCategorical()

~TorchCategorical. Destructor

Member Function Documentation

◆ build_from_logits()

build the distribution form logits

◆ build_from_probabilities()

build the distribution from probabilities

◆ entropy()

◆ get_logits()

◆ get_probs()

◆ log_prob()

log_prob

Parameters
value
Returns

Implements bitrl::maths::stats::TorchDistributionBase.

◆ sample()

virtual torch_tensor_t bitrl::maths::stats::TorchCategorical::sample ( c10::ArrayRef< int64_t > sample_shape = {})
overridevirtual

Ssample. Sample from the distribution.

Implements bitrl::maths::stats::TorchDistributionBase.


The documentation for this class was generated from the following file: