From 784baf63b1a7ea3cdcda5192a479889c34144df1 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 17 Aug 2019 16:04:55 +0200 Subject: [PATCH] Minor code refactoring --- .../FullyConnectedLayerBenchmark.cs | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/samples/ComputeSharp.Benchmark/FullyConnectedLayerBenchmark.cs b/samples/ComputeSharp.Benchmark/FullyConnectedLayerBenchmark.cs index f4c8f88a..d78499ed 100644 --- a/samples/ComputeSharp.Benchmark/FullyConnectedLayerBenchmark.cs +++ b/samples/ComputeSharp.Benchmark/FullyConnectedLayerBenchmark.cs @@ -12,31 +12,46 @@ namespace ComputeSharp.Benchmark /// /// The number of samples /// - private const int Count = 128; + private const int C = 128; /// - /// The nummber of rows in the matrix + /// The nummber of rows in the matrix /// private const int N = 100; /// - /// The number of columns in the matrix (same as the number of rows in the matrix) + /// The number of columns in the matrix (same as the number of rows in the matrix) /// private const int M = 100; /// - /// The number of columns in the matrix + /// The number of columns in the matrix /// private const int P = 100; - private readonly float[] A; + /// + /// The input tensor + /// + private readonly float[] X; + /// + /// The weights tensor + /// + private readonly float[] W; + + /// + /// The bias tensor + /// private readonly float[] B; - private readonly float[] C; - - private readonly float[] D; + /// + /// The result tensor + /// + private readonly float[] Y; + /// + /// A instance to initialize the tensors + /// private static readonly Random Random = new Random(); /// @@ -44,10 +59,10 @@ namespace ComputeSharp.Benchmark /// public FullyConnectedLayerBenchmark() { - A = CreateRandomArray(Count * N * M); - B = CreateRandomArray(M * P); - C = CreateRandomArray(N * P); - D = new float[Count * N * P]; + X = CreateRandomArray(C * N * M); + W = CreateRandomArray(M * P); + B = CreateRandomArray(P); + Y = CreateRandomArray(C * N * P); } ///