mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 07:27:46 +00:00
Store references instead of copying the results of intermediate autograd computations.
This commit is contained in:
+7
-7
@@ -392,11 +392,11 @@ namespace Learner
|
|||||||
{
|
{
|
||||||
using namespace Learner::Autograd::UnivariateStatic;
|
using namespace Learner::Autograd::UnivariateStatic;
|
||||||
|
|
||||||
static thread_local auto q_ = expected_perf_(VariableParameter<double, 0>{});
|
static thread_local auto& q_ = expected_perf_(VariableParameter<double, 0>{});
|
||||||
static thread_local auto p_ = expected_perf_(scale_score_(ConstantParameter<double, 1>{}));
|
static thread_local auto& p_ = expected_perf_(scale_score_(ConstantParameter<double, 1>{}));
|
||||||
static thread_local auto t_ = (ConstantParameter<double, 2>{} + 1.0) * 0.5;
|
static thread_local auto t_ = (ConstantParameter<double, 2>{} + 1.0) * 0.5;
|
||||||
static thread_local auto lambda_ = ConstantParameter<double, 3>{};
|
static thread_local auto lambda_ = ConstantParameter<double, 3>{};
|
||||||
static thread_local auto loss_ = cross_entropy_(q_, p_, t_, lambda_);
|
static thread_local auto& loss_ = cross_entropy_(q_, p_, t_, lambda_);
|
||||||
|
|
||||||
auto args = std::tuple(
|
auto args = std::tuple(
|
||||||
(double)shallow,
|
(double)shallow,
|
||||||
@@ -415,14 +415,14 @@ namespace Learner
|
|||||||
|
|
||||||
static thread_local auto ply_ = ConstantParameter<double, 4>{};
|
static thread_local auto ply_ = ConstantParameter<double, 4>{};
|
||||||
static thread_local auto shallow_ = VariableParameter<double, 0>{};
|
static thread_local auto shallow_ = VariableParameter<double, 0>{};
|
||||||
static thread_local auto q_ = expected_perf_use_wdl_(shallow_, ply_);
|
static thread_local auto& q_ = expected_perf_use_wdl_(shallow_, ply_);
|
||||||
// We could do just this but MSVC crashes with an internal compiler error :(
|
// We could do just this but MSVC crashes with an internal compiler error :(
|
||||||
// static thread_local auto scaled_teacher_ = scale_score_(ConstantParameter<double, 1>{});
|
// static thread_local auto& scaled_teacher_ = scale_score_(ConstantParameter<double, 1>{});
|
||||||
// static thread_local auto p_ = expected_perf_use_wdl_(scaled_teacher_, ply_);
|
// static thread_local auto& p_ = expected_perf_use_wdl_(scaled_teacher_, ply_);
|
||||||
static thread_local auto p_ = ConstantParameter<double, 1>{};
|
static thread_local auto p_ = ConstantParameter<double, 1>{};
|
||||||
static thread_local auto t_ = (ConstantParameter<double, 2>{} + 1.0) * 0.5;
|
static thread_local auto t_ = (ConstantParameter<double, 2>{} + 1.0) * 0.5;
|
||||||
static thread_local auto lambda_ = ConstantParameter<double, 3>{};
|
static thread_local auto lambda_ = ConstantParameter<double, 3>{};
|
||||||
static thread_local auto loss_ = cross_entropy_(q_, p_, t_, lambda_);
|
static thread_local auto& loss_ = cross_entropy_(q_, p_, t_, lambda_);
|
||||||
|
|
||||||
auto args = std::tuple(
|
auto args = std::tuple(
|
||||||
(double)shallow,
|
(double)shallow,
|
||||||
|
|||||||
Reference in New Issue
Block a user