Skip to content

Commit 2447cae

Browse files
Merge branch 'main' into unit
2 parents 5d70128 + 538f2e3 commit 2447cae

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

RELEASENOTES.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Releases, starting with 9/2/2021, are listed with the most recent release at the top.
44

5+
# NuGet Version 0.103.1
6+
7+
__Bug Fixes__:
8+
9+
#1383 `torch.linalg.vector_norm`: Make `ord`-argument optional, as specified in docs
10+
511
# NuGet Version 0.103.0
612

713
Move to libtorch 2.4.0.
@@ -115,8 +121,8 @@ Any code that checks whether a device is 'CUDA' and does something rather than c
115121

116122
__API Changes__:
117123

118-
#652: Apple Silicon support .<br/>
119-
#1219: Added support for loading and saving tensors that are >2GB.<br/>
124+
#652: Apple Silicon support .<br/>
125+
#1219: Added support for loading and saving tensors that are >2GB.<br/>
120126

121127
__Bug Fixes__:
122128

@@ -930,7 +936,7 @@ Added '_' to the torch.nn.init functions. They overwrite the input tensor, so th
930936

931937
__Fixed Bugs:__
932938

933-
#399 Data<T>() returns span that must be indexed using strides.
939+
#399 Data<T>() returns span that must be indexed using strides.
934940

935941
This was a major bug, affecting any code that pulled data out of a tensor view.
936942

src/TorchSharp/LinearAlgebra.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ public static Tensor tensorsolve(Tensor A, Tensor B, long[] dims)
703703
/// <param name="dims">Dimensions over which to compute the norm.</param>
704704
/// <param name="keepdim">If set to true, the reduced dimensions are retained in the result as dimensions with size one. </param>
705705
/// <returns></returns>
706-
public static Tensor vector_norm(Tensor input, double ord, long[]? dims = null, bool keepdim = false)
706+
public static Tensor vector_norm(Tensor input, double ord = 2d, long[]? dims = null, bool keepdim = false)
707707
{
708708
unsafe {
709709
fixed (long* pdims = dims) {

test/TorchSharpTest/LinearAlgebra.cs

+6
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,12 @@ public void VectorNormTest()
641641

642642
Assert.Equal(5.4344883f, b.item<float>());
643643
Assert.Equal(5.4344883f, c.item<float>());
644+
645+
var d = linalg.vector_norm(a, ord: 2);
646+
var e = linalg.vector_norm(a);
647+
648+
Assert.Equal(7.7459669f, d.item<float>());
649+
Assert.Equal(7.7459669f, e.item<float>());
644650
}
645651
}
646652

0 commit comments

Comments
 (0)