We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20a8eb9 commit ef76a68Copy full SHA for ef76a68
src/ConvNetSharp.Volume/NcwhVolumeStorage.cs
@@ -44,9 +44,17 @@ public override void Clear()
44
45
public override void CopyFrom(VolumeStorage<T> source)
46
{
47
- var real = source as NcwhVolumeStorage<T>;
+ var src = source as NcwhVolumeStorage<T>;
48
49
- Array.Copy(real._storage, this._storage, this._storage.Length);
+ if (!ReferenceEquals(this, src))
50
+ {
51
+ if (this.Shape.TotalLength != src.Shape.TotalLength)
52
53
+ throw new ArgumentException($"origin and destination volume should have the same number of weight ({this.Shape.TotalLength} != {src.Shape}).");
54
+ }
55
+
56
+ Array.Copy(src._storage, this._storage, this._storage.Length);
57
58
}
59
60
public override T Get(int[] coordinates)
0 commit comments