Skip to content

Commit 0d82897

Browse files
committed
Update TestTorchTensor.cs
1 parent 2fb57a0 commit 0d82897

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/TorchSharpTest/TestTorchTensor.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void Test1DToJuliaString()
117117
{
118118
Tensor t = torch.zeros(4);
119119
var str = t.jlstr(cultureInfo: CultureInfo.InvariantCulture);
120-
Assert.Equal($"[4], type = Float32, device = cpu\n 0 0 0 0\n", str);
120+
Assert.Equal($"[4], type = Float32, device = cpu{Environment.NewLine} 0 0 0 0{Environment.NewLine}", str);
121121
}
122122
{
123123
Tensor t = torch.zeros(4, torch.complex64);
@@ -151,12 +151,12 @@ public void Test2DToJuliaString()
151151
{
152152
Tensor t = torch.tensor(new float[] { 0.0f, 3.141f, 6.2834f, 3.14152f, 6.28e-06f, -13.141529f, 0.01f, 4713.14f }, 2, 4);
153153
var str = t.str(cultureInfo: CultureInfo.InvariantCulture);
154-
Assert.Equal($"[2x4], type = Float32, device = cpu\n 0 3.141 6.2834 3.1415\n 6.28e-06 -13.142 0.01 4713.1\n", str);
154+
Assert.Equal($"[2x4], type = Float32, device = cpu{Environment.NewLine} 0 3.141 6.2834 3.1415{Environment.NewLine} 6.28e-06 -13.142 0.01 4713.1{Environment.NewLine}", str);
155155
}
156156
if (torch.cuda.is_available()) {
157157
Tensor t = torch.tensor(new float[] { 0.0f, 3.141f, 6.2834f, 3.14152f, 6.28e-06f, -13.141529f, 0.01f, 4713.14f }, 2, 4, device: torch.CUDA);
158158
var str = t.str(cultureInfo: CultureInfo.InvariantCulture);
159-
Assert.Equal($"[2x4], type = Float32, device = cuda:0\n 0 3.141 6.2834 3.1415\n 6.28e-06 -13.142 0.01 4713.1\n", str);
159+
Assert.Equal($"[2x4], type = Float32, device = cuda:0{Environment.NewLine} 0 3.141 6.2834 3.1415{Environment.NewLine} 6.28e-06 -13.142 0.01 4713.1{Environment.NewLine}", str);
160160
}
161161
{
162162
Tensor t = torch.tensor(new float[] { 0.0f, 3.141f, 6.2834f, 3.14152f, 6.28e-06f, -13.141529f, 0.01f, 4713.14f }, 2, 4, device: torch.META);
@@ -187,7 +187,8 @@ public void Test3DToJuliaString()
187187
var str = t.jlstr("0.0000000", cultureInfo: CultureInfo.InvariantCulture);
188188
Assert.Equal($"[2x2x4], type = Float32, device = cpu\n[0,..,..] =\n 0.0000000 3.1410000 6.2834000 3.1415200\n" +
189189
$" 0.0000063 -13.1415300 0.0100000 4713.1400000\n\n[1,..,..] =\n 0.0100000 0.0000000 0.0000000 0.0000000\n" +
190-
$" 0.0000000 0.0000000 0.0000000 0.0000000\n", str);
190+
$" 0.0000000 0.0000000 0.0000000 0.0000000\n".Replace("\n", Environment.NewLine),
191+
str);
191192
}
192193
}
193194

0 commit comments

Comments
 (0)