Skip to content

Commit ef63c13

Browse files
committed
Add test for sine softmax.
1 parent 9b7bdbc commit ef63c13

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using ParallelReverseAutoDiff.RMAD;
2+
using Xunit;
3+
4+
namespace ParallelReverseAutoDiff.Test
5+
{
6+
public class SineSoftmaxTest
7+
{
8+
[Fact]
9+
public void GivenASineSoftmaxOperation_TheRowsAddUpToMoreThanPointEightOnAverage()
10+
{
11+
SineSoftmaxOperation op = new SineSoftmaxOperation();
12+
List<double> averages = new List<double>();
13+
for (int i = 5; i < 1000; ++i)
14+
{
15+
Matrix input = new Matrix(i, i);
16+
input.Initialize(InitializationType.Xavier);
17+
var output = op.Forward(input);
18+
Assert.NotNull(output);
19+
var sums = output.ToArray().ToList().Select(x => x.Sum()).ToList();
20+
var average = output.ToArray().ToList().Select(x => x.Sum()).Average();
21+
Assert.True(average > 0.8d);
22+
averages.Add(average);
23+
}
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)