Skip to content

Commit 0b28a75

Browse files
authored
Merge pull request #809 from dotnet/master
Update Live with current master
2 parents afe4ac5 + 2a8549a commit 0b28a75

File tree

8 files changed

+37
-34
lines changed

8 files changed

+37
-34
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#include <stdio.h>
2-
31
#if defined(__GNUC__)
42
#define EXPORT extern "C" __attribute__((visibility("default")))
53
#elif defined(_MSC_VER)
64
#define EXPORT extern "C" __declspec(dllexport)
75
#endif
86

9-
extern "C" EXPORT int NativeSum(int a, int b)
7+
EXPORT int NativeSum(int a, int b)
108
{
119
return a + b;
1210
}

core/hosting/HostWithCoreClrHost/src/SampleHost.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,6 @@ int main(int argc, char* argv[])
238238
printf("coreclr_shutdown failed - status: 0x%08x\n", hr);
239239
}
240240

241-
// Unload CoreCLR
242-
#if WINDOWS
243-
if (!FreeLibrary(coreClr))
244-
{
245-
printf("Failed to free coreclr.dll\n");
246-
}
247-
#elif LINUX
248-
if (dlclose(coreClr))
249-
{
250-
printf("Failed to free libcoreclr.so\n");
251-
}
252-
#endif
253241
return 0;
254242
}
255243

machine-learning/tutorials/IrisFlowerClustering/IrisFlowerClustering.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.ML" Version="0.11.0" />
13+
<PackageReference Include="Microsoft.ML" Version="1.0.0-preview" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

machine-learning/tutorials/IrisFlowerClustering/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// </SnippetUsingsForPaths>
55

66
// <SnippetMLUsings>
7-
using Microsoft.Data.DataView;
87
using Microsoft.ML;
98
using Microsoft.ML.Data;
109
// </SnippetMLUsings>
@@ -32,7 +31,7 @@ static void Main(string[] args)
3231
string featuresColumnName = "Features";
3332
var pipeline = mlContext.Transforms
3433
.Concatenate(featuresColumnName, "SepalLength", "SepalWidth", "PetalLength", "PetalWidth")
35-
.Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, clustersCount: 3));
34+
.Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, numberOfClusters: 3));
3635
// </SnippetCreatePipeline>
3736

3837
// <SnippetTrainModel>
@@ -42,12 +41,12 @@ static void Main(string[] args)
4241
// <SnippetSaveModel>
4342
using (var fileStream = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
4443
{
45-
mlContext.Model.Save(model, fileStream);
44+
mlContext.Model.Save(model, dataView.Schema, fileStream);
4645
}
4746
// </SnippetSaveModel>
4847

4948
// <SnippetPredictor>
50-
var predictor = model.CreatePredictionEngine<IrisData, ClusterPrediction>(mlContext);
49+
var predictor = mlContext.Model.CreatePredictionEngine<IrisData, ClusterPrediction>(model);
5150
// </SnippetPredictor>
5251

5352
// <SnippetPredictionExample>

snippets/csharp/VS_Snippets_CLR_System/system.threading.threadlocal/cs/threadlocal.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,14 @@ static void Main()
3535
ThreadName.Dispose();
3636
}
3737
}
38-
39-
//</snippet01>
38+
// This multithreading example can produce different outputs for each 'action' invocation and will vary with each run.
39+
// Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor):
40+
// ThreadName = Thread5
41+
// ThreadName = Thread6
42+
// ThreadName = Thread4
43+
// ThreadName = Thread6 (repeat)
44+
// ThreadName = Thread1
45+
// ThreadName = Thread4 (repeat)
46+
// ThreadName = Thread7
47+
// ThreadName = Thread5 (repeat)
48+
//</snippet01>

snippets/csharp/keywords/StackAllocExamples.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ public static void Examples()
1111
InitializeBitMasks();
1212
}
1313

14-
private static unsafe void InitializeBitMasks()
14+
private static void InitializeBitMasks()
1515
{
1616
// <Snippet2>
17-
int* mask = stackalloc[] {
17+
ReadOnlySpan<int> mask = stackalloc[] {
1818
0b_0000_0000_0000_0001,
1919
0b_0000_0000_0000_0010,
2020
0b_0000_0000_0000_0100,
@@ -61,14 +61,13 @@ private static unsafe void FibonacciGeneration()
6161
{
6262
// <Snippet1>
6363
const int arraySize = 20;
64-
int* fib = stackalloc int[arraySize];
65-
int* p = fib;
64+
Span<int> fib = stackalloc int[arraySize];
6665
// The sequence begins with 1, 1.
67-
*p++ = *p++ = 1;
68-
for (int i = 2; i < arraySize; ++i, ++p)
66+
fib[0] = fib[1] = 1;
67+
for (int i = 2; i < arraySize; ++i)
6968
{
7069
// Sum the previous two numbers.
71-
*p = p[-1] + p[-2];
70+
fib[i] = fib[i-1] + fib[i-2];
7271
}
7372
for (int i = 0; i < arraySize; ++i)
7473
{

snippets/visualbasic/VS_Snippets_CLR_System/system.collections.generic.list.sort/vb/Sort1.vb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Imports System.Collections.Generic
77
Module Example
88
Public Sub Main()
99
Dim names() As String = { "Samuel", "Dakota", "Koani", "Saya",
10-
"Vanya", "Yiska", "Yuma", "Jody",
11-
"Nikita" }
10+
"Vanya", "Jody", "Yiska", "Yuma",
11+
"Jody", "Nikita" }
1212
Dim nameList As New List(Of String)()
1313
nameList.AddRange(names)
1414
Console.WriteLine("List in unsorted order: ")
@@ -27,8 +27,8 @@ Module Example
2727
End Module
2828
' The example displays the following output:
2929
' List in unsorted order:
30-
' Samuel Dakota Koani Saya Vanya Yiska Yuma Jody Nikita
30+
' Samuel Dakota Koani Saya Vanya Jody Yiska Yuma Jody Nikita
3131
'
3232
' List in sorted order:
33-
' Dakota Jody Koani Nikita Samuel Saya Vanya Yiska Yuma
33+
' Dakota Jody Jody Koani Nikita Samuel Saya Vanya Yiska Yuma
3434
' </Snippet2>

snippets/visualbasic/VS_Snippets_CLR_System/system.threading.threadlocal/vb/threadlocal.vb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,14 @@ Module ThreadLocalDemo
3232
ThreadName.Dispose()
3333
End Sub
3434
End Module
35-
'</snippet01>
35+
' This multithreading example can produce different outputs for each 'action' invocation and will vary with each run.
36+
' Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor):
37+
' ThreadName = Thread5
38+
' ThreadName = Thread6
39+
' ThreadName = Thread4
40+
' ThreadName = Thread6 (repeat)
41+
' ThreadName = Thread1
42+
' ThreadName = Thread4 (repeat)
43+
' ThreadName = Thread7
44+
' ThreadName = Thread5 (repeat)
45+
'</snippet01>

0 commit comments

Comments
 (0)