112 Tensor last_action_indices_;
113 bool has_forwarded_ =
false;
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:219
loss = mean_b( -log pi(a_b | s_b) * G_b ), where a_b is the action actually taken on step b of a roll...
Definition policy_gradient_loss.hpp:52
Tensor backward() const
Gradient w.r.t. logits: returns[b,0] * (p[b,k] - 1{k == a_b}) / N, the softmax/cross-entropy gradient...
float forward(const Tensor &logits, const Tensor &actions, const Tensor &returns)
Computes the return-weighted negative log-likelihood and caches what backward() needs.
PolicyGradientLoss(DeviceBackend *backend)
Constructs a policy-gradient loss.
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Abstract interface isolating vendor-specific memory/compute operations from Tensor/ComputationGraph.
Definition acquisition_functions.hpp:16
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).