From b7000eee387781cf928a75e812f580ccc968da47 Mon Sep 17 00:00:00 2001 From: Franklin Moormann Date: Wed, 29 Oct 2025 11:40:41 -0400 Subject: [PATCH] fix(us-bf-057): improve step/calculateupdate exception messages in optimizerbase --- src/Optimizers/OptimizerBase.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Optimizers/OptimizerBase.cs b/src/Optimizers/OptimizerBase.cs index f6a7718ab8..5610643533 100644 --- a/src/Optimizers/OptimizerBase.cs +++ b/src/Optimizers/OptimizerBase.cs @@ -1105,9 +1105,9 @@ protected virtual void DeserializeAdditionalData(BinaryReader reader) public virtual void Step() { throw new NotImplementedException( - "Step() method is not implemented for this optimizer type. " + - "This optimizer may be a non-gradient-based optimizer that uses the Optimize() method instead, " + - "or the derived class needs to implement the Step() method."); + $"The 'Step()' method is not implemented for optimizer type '{GetType().Name}'. " + + "For gradient-based optimizers, this method must be overridden by the derived class. " + + "For non-gradient-based optimizers, consider using the 'Optimize()' method instead."); } /// @@ -1118,9 +1118,9 @@ public virtual void Step() public virtual Dictionary> CalculateUpdate(Dictionary> gradients) { throw new NotImplementedException( - "CalculateUpdate() method is not implemented for this optimizer type. " + - "This optimizer may be a non-gradient-based optimizer that uses the Optimize() method instead, " + - "or the derived class needs to implement the CalculateUpdate() method."); + $"The 'CalculateUpdate()' method is not implemented for optimizer type '{GetType().Name}'. " + + "For gradient-based optimizers, this method must be overridden by the derived class. " + + "For non-gradient-based optimizers, consider using the 'Optimize()' method instead."); } ///