10#ifdef MOOSE_LIBTORCH_ENABLED
16#include <torch/torch.h>
56 std::vector<LibtorchRLMiniBatch>
58 unsigned int batch_size,
59 bool standardize_advantage,
60 c10::optional<at::Generator> generator = c10::nullopt)
const;
76 const torch::Tensor & indices,
77 bool standardize_advantage);
Samples shuffled mini-batches from a flattened on-policy trajectory batch.
static void validateBatch(const LibtorchRLTrajectoryBuffer::TensorBatch &batch)
Sanity-check that the flattened rollout tensors all line up.
std::vector< LibtorchRLMiniBatch > sample(const LibtorchRLTrajectoryBuffer::TensorBatch &batch, unsigned int batch_size, bool standardize_advantage, c10::optional< at::Generator > generator=c10::nullopt) const
Shuffle a flattened rollout batch into PPO-sized chunks.
static LibtorchRLMiniBatch makeMiniBatch(const LibtorchRLTrajectoryBuffer::TensorBatch &batch, const torch::Tensor &indices, bool standardize_advantage)
Slice one shuffled mini-batch out of the flattened rollout tensors.
Tensor data for one PPO mini-batch.
torch::Tensor actions
Action rows that match the sampled observations.
torch::Tensor value_targets
Critic targets aligned with the sampled observations.
std::int64_t size() const
Return the number of rows stored in the mini-batch.
torch::Tensor old_log_probabilities
Behavior-policy log probabilities for the sampled actions.
torch::Tensor advantages
Advantage estimates aligned with the sampled observations.
torch::Tensor observations
Flattened observation rows for the mini-batch.
Flattened tensor data assembled from the stored trajectories.