Skip to content

Commit 3bfccfd

Browse files
committed
fix: use public api in loss scaler tests
Replace protected _data field access with GetFlatIndexValue() method in test assertions Addresses review comment from copilot-pull-request-reviewer
1 parent f10da03 commit 3bfccfd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/AiDotNet.Tests/UnitTests/MixedPrecision/LossScalerTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public void UnscaleGradients_Tensor_CorrectlyUnscalesAllElements()
9898
scaler.UnscaleGradients(gradients);
9999

100100
// Assert
101-
Assert.Equal(1.0f, gradients._data[0], precision: 5);
102-
Assert.Equal(2.0f, gradients._data[1], precision: 5);
103-
Assert.Equal(3.0f, gradients._data[2], precision: 5);
104-
Assert.Equal(4.0f, gradients._data[3], precision: 5);
101+
Assert.Equal(1.0f, gradients.GetFlatIndexValue(0), precision: 5);
102+
Assert.Equal(2.0f, gradients.GetFlatIndexValue(1), precision: 5);
103+
Assert.Equal(3.0f, gradients.GetFlatIndexValue(2), precision: 5);
104+
Assert.Equal(4.0f, gradients.GetFlatIndexValue(3), precision: 5);
105105
}
106106

107107
[Fact]

0 commit comments

Comments
 (0)