Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions core/extensions/DllMapDemo/NewLib.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include <stdio.h>

#if defined(__GNUC__)
#define EXPORT extern "C" __attribute__((visibility("default")))
#elif defined(_MSC_VER)
#define EXPORT extern "C" __declspec(dllexport)
#endif

extern "C" EXPORT int NativeSum(int a, int b)
EXPORT int NativeSum(int a, int b)
{
return a + b;
}
12 changes: 0 additions & 12 deletions core/hosting/HostWithCoreClrHost/src/SampleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,6 @@ int main(int argc, char* argv[])
printf("coreclr_shutdown failed - status: 0x%08x\n", hr);
}

// Unload CoreCLR
#if WINDOWS
if (!FreeLibrary(coreClr))
{
printf("Failed to free coreclr.dll\n");
}
#elif LINUX
if (dlclose(coreClr))
{
printf("Failed to free libcoreclr.so\n");
}
#endif
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="0.11.0" />
<PackageReference Include="Microsoft.ML" Version="1.0.0-preview" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 3 additions & 4 deletions machine-learning/tutorials/IrisFlowerClustering/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </SnippetUsingsForPaths>

// <SnippetMLUsings>
using Microsoft.Data.DataView;
using Microsoft.ML;
using Microsoft.ML.Data;
// </SnippetMLUsings>
Expand Down Expand Up @@ -32,7 +31,7 @@ static void Main(string[] args)
string featuresColumnName = "Features";
var pipeline = mlContext.Transforms
.Concatenate(featuresColumnName, "SepalLength", "SepalWidth", "PetalLength", "PetalWidth")
.Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, clustersCount: 3));
.Append(mlContext.Clustering.Trainers.KMeans(featuresColumnName, numberOfClusters: 3));
// </SnippetCreatePipeline>

// <SnippetTrainModel>
Expand All @@ -42,12 +41,12 @@ static void Main(string[] args)
// <SnippetSaveModel>
using (var fileStream = new FileStream(_modelPath, FileMode.Create, FileAccess.Write, FileShare.Write))
{
mlContext.Model.Save(model, fileStream);
mlContext.Model.Save(model, dataView.Schema, fileStream);
}
// </SnippetSaveModel>

// <SnippetPredictor>
var predictor = model.CreatePredictionEngine<IrisData, ClusterPrediction>(mlContext);
var predictor = mlContext.Model.CreatePredictionEngine<IrisData, ClusterPrediction>(model);
// </SnippetPredictor>

// <SnippetPredictionExample>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,14 @@ static void Main()
ThreadName.Dispose();
}
}

//</snippet01>
// This multithreading example can produce different outputs for each 'action' invocation and will vary with each run.
// Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor):
// ThreadName = Thread5
// ThreadName = Thread6
// ThreadName = Thread4
// ThreadName = Thread6 (repeat)
// ThreadName = Thread1
// ThreadName = Thread4 (repeat)
// ThreadName = Thread7
// ThreadName = Thread5 (repeat)
//</snippet01>
13 changes: 6 additions & 7 deletions snippets/csharp/keywords/StackAllocExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public static void Examples()
InitializeBitMasks();
}

private static unsafe void InitializeBitMasks()
private static void InitializeBitMasks()
{
// <Snippet2>
int* mask = stackalloc[] {
ReadOnlySpan<int> mask = stackalloc[] {
0b_0000_0000_0000_0001,
0b_0000_0000_0000_0010,
0b_0000_0000_0000_0100,
Expand Down Expand Up @@ -61,14 +61,13 @@ private static unsafe void FibonacciGeneration()
{
// <Snippet1>
const int arraySize = 20;
int* fib = stackalloc int[arraySize];
int* p = fib;
Span<int> fib = stackalloc int[arraySize];
// The sequence begins with 1, 1.
*p++ = *p++ = 1;
for (int i = 2; i < arraySize; ++i, ++p)
fib[0] = fib[1] = 1;
for (int i = 2; i < arraySize; ++i)
{
// Sum the previous two numbers.
*p = p[-1] + p[-2];
fib[i] = fib[i-1] + fib[i-2];
}
for (int i = 0; i < arraySize; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Imports System.Collections.Generic
Module Example
Public Sub Main()
Dim names() As String = { "Samuel", "Dakota", "Koani", "Saya",
"Vanya", "Yiska", "Yuma", "Jody",
"Nikita" }
"Vanya", "Jody", "Yiska", "Yuma",
"Jody", "Nikita" }
Dim nameList As New List(Of String)()
nameList.AddRange(names)
Console.WriteLine("List in unsorted order: ")
Expand All @@ -27,8 +27,8 @@ Module Example
End Module
' The example displays the following output:
' List in unsorted order:
' Samuel Dakota Koani Saya Vanya Yiska Yuma Jody Nikita
' Samuel Dakota Koani Saya Vanya Jody Yiska Yuma Jody Nikita
'
' List in sorted order:
' Dakota Jody Koani Nikita Samuel Saya Vanya Yiska Yuma
' Dakota Jody Jody Koani Nikita Samuel Saya Vanya Yiska Yuma
' </Snippet2>
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ Module ThreadLocalDemo
ThreadName.Dispose()
End Sub
End Module
'</snippet01>
' This multithreading example can produce different outputs for each 'action' invocation and will vary with each run.
' Therefore, the example output will resemble but may not exactly match the following output (from a 4 core processor):
' ThreadName = Thread5
' ThreadName = Thread6
' ThreadName = Thread4
' ThreadName = Thread6 (repeat)
' ThreadName = Thread1
' ThreadName = Thread4 (repeat)
' ThreadName = Thread7
' ThreadName = Thread5 (repeat)
'</snippet01>