bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
torch_parameters.h File Reference
#include "bitrl/base/bitrl_config.h"
#include "bitrl/base/bitrl_types.h"
#include "bitrl/rl/distributed/communicator.h"
#include <torch/torch.h>
#include <cstdint>
#include <cstring>
#include <stdexcept>
#include <vector>
Include dependency graph for torch_parameters.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bitrl
 Various utilities used when working with RL problems.
namespace  bitrl::rl
namespace  bitrl::rl::distributed
namespace  bitrl::rl::distributed::detail

Functions

void bitrl::rl::distributed::detail::check_float_ (const torch::Tensor &t)
template<typename Get>
std::vector< float > bitrl::rl::distributed::detail::flatten_ (const std::vector< torch::Tensor > &tensors, Get get)
std::vector< float > bitrl::rl::distributed::flatten_parameters (const std::vector< torch::Tensor > &parameters)
 The values of the parameters, one after the other.
std::vector< float > bitrl::rl::distributed::flatten_gradients (const std::vector< torch::Tensor > &parameters)
 The gradients of the parameters, one after the other; 0 where a parameter has none.
void bitrl::rl::distributed::set_parameters (const std::vector< torch::Tensor > &parameters, const std::vector< float > &values)
 Copy values, as flatten_parameters() gives them, into the parameters.
void bitrl::rl::distributed::set_gradients (const std::vector< torch::Tensor > &parameters, const std::vector< float > &values)
 Copy values, as flatten_gradients() gives them, into the gradients.
void bitrl::rl::distributed::average_gradients (Communicator &communicator, const std::vector< torch::Tensor > &parameters)
 Replace the gradients of every rank with their mean over the ranks.
void bitrl::rl::distributed::broadcast_parameters (Communicator &communicator, const std::vector< torch::Tensor > &parameters, uint_t root=0)
 Give every rank the parameters of root.
std::uint64_t bitrl::rl::distributed::parameters_checksum (const std::vector< torch::Tensor > &parameters)
 A checksum of the parameters, to tell that the ranks have the same.