Skip to content

Commit 73d5bc3

Browse files
committed
NuGet packages updated
1 parent ea21400 commit 73d5bc3

File tree

11 files changed

+21
-20
lines changed

11 files changed

+21
-20
lines changed

NeuralNetwork.NET/APIs/DatasetLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
using NeuralNetworkNET.SupervisedLearning.Data;
1010
using NeuralNetworkNET.SupervisedLearning.Parameters;
1111
using NeuralNetworkNET.SupervisedLearning.Progress;
12-
using SixLabors.ImageSharp;
1312
using SixLabors.ImageSharp.PixelFormats;
13+
using SixLabors.ImageSharp.Processing;
1414

1515
namespace NeuralNetworkNET.APIs
1616
{

NeuralNetwork.NET/APIs/Datasets/Cifar10.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private static unsafe void ExportSamples([NotNull] DirectoryInfo folder, (string
150150
int label = stream.ReadByte();
151151
stream.Read(temp, 0, SampleSize);
152152
using (Image<Rgb24> image = new Image<Rgb24>(32, 32))
153-
fixed (Rgb24* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
153+
fixed (Rgb24* p0 = image.GetPixelSpan())
154154
{
155155
for (int j = 0; j < ImageSize; j++)
156156
p0[j] = new Rgb24(ptemp[j], ptemp[j + ImageSize], ptemp[j + 2 * ImageSize]);

NeuralNetwork.NET/APIs/Datasets/Cifar100.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static unsafe void ExportSamples([NotNull] DirectoryInfo folder, (string
188188
fine = stream.ReadByte();
189189
stream.Read(temp, 0, SampleSize);
190190
using (Image<Rgb24> image = new Image<Rgb24>(32, 32))
191-
fixed (Rgb24* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
191+
fixed (Rgb24* p0 = image.GetPixelSpan())
192192
{
193193
for (int j = 0; j < ImageSize; j++)
194194
p0[j] = new Rgb24(ptemp[j], ptemp[j + ImageSize], ptemp[j + 2 * ImageSize]);

NeuralNetwork.NET/APIs/Datasets/Mnist.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private static unsafe void ExportSamples([NotNull] DirectoryInfo folder, (string
172172
xGzip.Read(temp, 0, SampleSize);
173173
int label = yGzip.ReadByte();
174174
using (Image<Rgb24> image = new Image<Rgb24>(28, 28))
175-
fixed (Rgb24* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
175+
fixed (Rgb24* p0 = image.GetPixelSpan())
176176
{
177177
for (int j = 0; j < SampleSize; j++)
178178
p0[j] = new Rgb24(ptemp[j], ptemp[j], ptemp[j]);

NeuralNetwork.NET/Extensions/DebugExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal static class DebugExtensions
1919
public static unsafe bool ContentEquals(this Span<float> x1, Span<float> x2, float absolute = 1e-6f, float relative = 1e-6f)
2020
{
2121
if (x1.Length != x2.Length) return false;
22-
fixed (float* p1 = &x1.DangerousGetPinnableReference(), p2 = &x2.DangerousGetPinnableReference())
22+
fixed (float* p1 = x1, p2 = x2)
2323
{
2424
for (int i = 0; i < x1.Length; i++)
2525
if (!p1[i].EqualsWithDelta(p2[i], absolute, relative))

NeuralNetwork.NET/Extensions/SpanExtensions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static unsafe void Fill<T>(this Span<T> span, [NotNull] Func<T> provider)
2323
cores = Environment.ProcessorCount,
2424
batch = span.Length / cores,
2525
mod = span.Length % cores;
26-
fixed (T* p0 = &span.DangerousGetPinnableReference())
26+
fixed (T* p0 = span)
2727
{
2828
T* pc = p0;
2929
Parallel.For(0, cores, i =>
@@ -65,7 +65,7 @@ public static unsafe void Fill<T>(this Span<T> span, [NotNull] Func<T> provider)
6565
[Pure]
6666
public static unsafe int GetContentHashCode<T>(this Span<T> span) where T : unmanaged
6767
{
68-
fixed (T* p0 = &span.DangerousGetPinnableReference())
68+
fixed (T* p0 = span)
6969
{
7070
int hash = 17;
7171
unchecked
@@ -106,7 +106,7 @@ public static unsafe int Argmax(this Span<float> span)
106106
if (span.Length < 2) return default;
107107
int index = 0;
108108
float max = float.MinValue;
109-
fixed (float* p = &span.DangerousGetPinnableReference())
109+
fixed (float* p = span)
110110
{
111111
for (int j = 0; j < span.Length; j++)
112112
{
@@ -133,7 +133,7 @@ public static unsafe int Argmax(this Span<float> span)
133133
internal static unsafe bool MatchElementwiseThreshold(this Span<float> x1, Span<float> x2, float threshold)
134134
{
135135
if (x1.Length != x2.Length) throw new ArgumentException("The two input spans must have the same length");
136-
fixed (float* px1 = &x1.DangerousGetPinnableReference(), px2 = &x2.DangerousGetPinnableReference())
136+
fixed (float* px1 = x1, px2 = x2)
137137
for (int i = 0; i < x1.Length; i++)
138138
if (px1[i] > threshold != px2[i] > threshold)
139139
return false;
@@ -152,7 +152,7 @@ internal static unsafe bool MatchElementwiseThreshold(this Span<float> x1, Span<
152152
internal static unsafe bool IsCloseTo(this Span<float> x1, Span<float> x2, float threshold)
153153
{
154154
if (x1.Length != x2.Length) throw new ArgumentException("The two input spans must have the same length");
155-
fixed (float* px1 = &x1.DangerousGetPinnableReference(), px2 = &x2.DangerousGetPinnableReference())
155+
fixed (float* px1 = x1, px2 = x2)
156156
for (int i = 0; i < x1.Length; i++)
157157
if ((px1[i] - px2[i]).Abs() > threshold)
158158
return false;

NeuralNetwork.NET/Helpers/ImageLoader.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using SixLabors.ImageSharp;
77
using SixLabors.ImageSharp.Advanced;
88
using SixLabors.ImageSharp.PixelFormats;
9+
using SixLabors.ImageSharp.Processing;
910

1011
namespace NeuralNetworkNET.Helpers
1112
{
@@ -42,7 +43,7 @@ private static unsafe float[] Load(Image<Argb32> image, ImageNormalizationMode n
4243
{
4344
int resolution = image.Height * image.Width;
4445
float[] sample = new float[resolution * 4];
45-
fixed (Argb32* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
46+
fixed (Argb32* p0 = image.GetPixelSpan())
4647
fixed (float* psample = sample)
4748
{
4849
for (int i = 0; i < resolution; i++)
@@ -63,7 +64,7 @@ private static unsafe float[] Load(Image<Rgba32> image, ImageNormalizationMode n
6364
{
6465
int resolution = image.Height * image.Width;
6566
float[] sample = new float[resolution * 4];
66-
fixed (Rgba32* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
67+
fixed (Rgba32* p0 = image.GetPixelSpan())
6768
fixed (float* psample = sample)
6869
{
6970
for (int i = 0; i < resolution; i++)
@@ -84,7 +85,7 @@ private static unsafe float[] Load(Image<Rgb24> image, ImageNormalizationMode no
8485
{
8586
int resolution = image.Height * image.Width;
8687
float[] sample = new float[resolution * 3];
87-
fixed (Rgb24* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
88+
fixed (Rgb24* p0 = image.GetPixelSpan())
8889
fixed (float* psample = sample)
8990
{
9091
for (int i = 0; i < resolution; i++)
@@ -104,7 +105,7 @@ private static unsafe float[] Load(Image<Alpha8> image, ImageNormalizationMode n
104105
{
105106
int resolution = image.Height * image.Width;
106107
float[] sample = new float[resolution];
107-
fixed (Alpha8* p0 = &image.DangerousGetPinnableReferenceToPixelBuffer())
108+
fixed (Alpha8* p0 = image.GetPixelSpan())
108109
fixed (float* psample = sample)
109110
for (int i = 0; i < resolution; i++)
110111
{

NeuralNetwork.NET/Networks/Graph/Nodes/SumNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public CudaSumNode(ActivationType activation, [NotNull] [ItemNotNull] IReadOnlyL
121121
public override unsafe void Forward(Span<Tensor> inputs, out Tensor z, out Tensor a)
122122
{
123123
Descriptor.Set4D(DataType.FLOAT, TensorFormat.CUDNN_TENSOR_NCHW, inputs[0].Entities, inputs[0].Length, 1, 1);
124-
fixed (Tensor* p = &inputs.DangerousGetPinnableReference())
124+
fixed (Tensor* p = inputs)
125125
{
126126
Tensor.New(p->Entities, p->Length, out z);
127127
using (DeviceMemory<float> y_gpu = DnnInstance.Gpu.AllocateDevice(*p))

NeuralNetwork.NET/NeuralNetwork.NET.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
<ItemGroup>
4646
<PackageReference Include="Alea" Version="3.0.4" />
4747
<PackageReference Include="FSharp.Core" Version="4.2.3" />
48-
<PackageReference Include="JetBrains.Annotations" Version="11.1.0" />
49-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
48+
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1" />
49+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
5050
<PackageReference Include="SharpZipLib.NETStandard" Version="1.0.7" />
51-
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0002" />
51+
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0005" />
5252
</ItemGroup>
5353

5454
<ItemGroup>

NeuralNetwork.NET/cpuDNN/CpuBlas.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static unsafe void Sum(Span<Tensor> inputs, in Tensor y)
109109
count = inputs.Length,
110110
n = y.Entities,
111111
l = y.Length;
112-
fixed (Tensor * p = &inputs.DangerousGetPinnableReference())
112+
fixed (Tensor * p = inputs)
113113
{
114114
// Initial checks
115115
float** ps = stackalloc float*[count];

0 commit comments

Comments
 (0)