Skip to content

Commit 4a8ad63

Browse files
committed
Minor code style tweaks
1 parent 235d0dc commit 4a8ad63

File tree

22 files changed

+36
-29
lines changed

22 files changed

+36
-29
lines changed

NeuralNetwork.NET/APIs/Enums/PoolingMode.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
namespace NeuralNetworkNET.APIs.Enums
1+
using JetBrains.Annotations;
2+
3+
namespace NeuralNetworkNET.APIs.Enums
24
{
35
/// <summary>
46
/// Indicates the pooling mode performed by a pooling layer
57
/// </summary>
8+
[PublicAPI]
69
public enum PoolingMode : byte
710
{
811
/// <summary>

NeuralNetwork.NET/APIs/Interfaces/Data/IDataset.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using NeuralNetworkNET.APIs.Structs;
1+
using JetBrains.Annotations;
2+
using NeuralNetworkNET.APIs.Structs;
23

34
namespace NeuralNetworkNET.APIs.Interfaces.Data
45
{
56
/// <summary>
67
/// An interface for a dataset used to train or test a network
78
/// </summary>
9+
[PublicAPI]
810
public interface IDataset
911
{
1012
/// <summary>

NeuralNetwork.NET/APIs/Interfaces/INeuralNetwork.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace NeuralNetworkNET.APIs.Interfaces
1111
/// <summary>
1212
/// An interface to mask a neural network implementation
1313
/// </summary>
14+
[PublicAPI]
1415
public interface INeuralNetwork : IEquatable<INeuralNetwork>, IClonable<INeuralNetwork>
1516
{
1617
#region Properties

NeuralNetwork.NET/APIs/Interfaces/ITrainingAlgorithmInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using NeuralNetworkNET.SupervisedLearning.Algorithms;
1+
using JetBrains.Annotations;
2+
using NeuralNetworkNET.SupervisedLearning.Algorithms;
23

34
namespace NeuralNetworkNET.APIs.Interfaces
45
{
56
/// <summary>
67
/// A common interface for all the available training algorithms in the library
78
/// </summary>
9+
[PublicAPI]
810
public interface ITrainingAlgorithmInfo
911
{
1012
/// <summary>

NeuralNetwork.NET/APIs/NetworkLoader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ namespace NeuralNetworkNET.APIs
1414
/// <summary>
1515
/// A static class that handles the JSON deserialization for the neural networks
1616
/// </summary>
17+
[PublicAPI]
1718
public static class NetworkLoader
1819
{
1920
/// <summary>
2021
/// Gets the file extension used when saving a network
2122
/// </summary>
22-
public const String NetworkFileExtension = ".nnet";
23+
public const string NetworkFileExtension = ".nnet";
2324

2425
/// <summary>
2526
/// Tries to deserialize a network from the input file

NeuralNetwork.NET/APIs/Structs/Tensor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace NeuralNetworkNET.APIs.Structs
1212
/// <summary>
1313
/// A readonly struct that holds the info on an unmanaged memory area that has been allocated
1414
/// </summary>
15+
[PublicAPI]
1516
[DebuggerTypeProxy(typeof(_TensorProxy))]
1617
[DebuggerDisplay("Entities: {Entities}, Length: {Length}, Ptr: {Ptr}")]
1718
public readonly struct Tensor

NeuralNetwork.NET/Extensions/DebugExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace NeuralNetworkNET.Extensions
77
/// <summary>
88
/// A static class that contains some extensions to check the contents of various types of <see cref="float"/> vectors
99
/// </summary>
10-
public static class DebugExtensions
10+
internal static class DebugExtensions
1111
{
1212
/// <summary>
1313
/// Checks if two <see cref="Span{T}"/> instances have the same size and content

NeuralNetwork.NET/Helpers/DatasetsDownloader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private static String DatasetsPath
3737
String
3838
code = Assembly.GetExecutingAssembly().Location,
3939
dll = Path.GetFullPath(code),
40-
root = Path.GetDirectoryName(dll),
40+
root = Path.GetDirectoryName(dll) ?? throw new NullReferenceException("The root path can't be null"),
4141
path = Path.Combine(root, "Datasets");
4242
return path;
4343
}
@@ -136,7 +136,7 @@ public static async Task<IReadOnlyDictionary<String, Func<Stream>>> GetArchiveAs
136136

137137
// Move all the contents in the root directory
138138
foreach (String path in Directory.EnumerateFiles(folder, "*", SearchOption.AllDirectories))
139-
File.Move(path, Path.Combine(folder, Path.GetFileName(path)));
139+
File.Move(path, Path.Combine(folder, Path.GetFileName(path ?? throw new NullReferenceException("Invalid path"))));
140140

141141
// Delete the subfolders
142142
foreach (String subdir in Directory.GetDirectories(folder))

NeuralNetwork.NET/Helpers/SharedEvent.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ public void Add(Action action)
2323
_InvocationList += action;
2424
}
2525

26-
/// <summary>
27-
/// Removes the input <see cref="Action"/> from the list of handlers
28-
/// </summary>
29-
/// <param name="action">The <see cref="Action"/> to remove</param>
30-
public void Remove(Action action) => Delegate.Remove(_InvocationList, action);
31-
3226
/// <summary>
3327
/// Raises the shared event
3428
/// </summary>

NeuralNetwork.NET/Helpers/ThreadSafeRandom.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static float NextGaussian(float deviation = 1)
8383
/// <param name="mask">The resulting mask</param>
8484
public static unsafe void NextDropoutMask(int x, int y, float dropout, out Tensor mask)
8585
{
86-
if (x <= 0 || y <= 0) throw new ArgumentOutOfRangeException("The size of the matrix isn't valid");
86+
if (x <= 0 || y <= 0) throw new ArgumentOutOfRangeException(nameof(x), "The size of the matrix isn't valid");
8787
float scale = 1 / dropout;
8888
Tensor.New(x, y, out mask);
8989
float* r = mask;

0 commit comments

Comments
 (0)