Skip to content

Commit 04c2de0

Browse files
author
msdmkats
authored
Fixed IronPython examples (#5)
* IronPython examples now work. * Removed an obsolete path from TestWrapper.pyproj
1 parent 9a9f142 commit 04c2de0

File tree

7 files changed

+15
-6
lines changed

7 files changed

+15
-6
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -259,4 +259,7 @@ apiguide-tmp/
259259
_site/
260260

261261
#code generated by iron python examples
262-
IronPythonWrapper/InferNetExamples/InferNetExamples/GeneratedSource/
262+
src/IronPythonWrapper/InferNetExamples/InferNetExamples/GeneratedSource/
263+
264+
#Compiler for IronPython
265+
src/IronPythonWrapper/Compiler

src/IronPythonWrapper/InferNetExamples/InferNetExamples/GaussianRanges.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ def gaussian_ranges():
2929
x.ObservedValue = data
3030

3131
# The inference
32-
ie = InferenceEngine(VariationalMessagePassing())
32+
ie = InferenceEngine(Algorithms.VariationalMessagePassing())
3333
print "mean = ", ie.Infer(mean)
3434
print "prec = ", ie.Infer(precision)

src/IronPythonWrapper/InferNetExamples/InferNetExamples/InferNetExamples.pyproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ProjectGuid>{44d352de-299b-4409-9371-949ac48b4225}</ProjectGuid>
77
<ProjectHome>.</ProjectHome>
88
<StartupFile>InferNetExamples.py</StartupFile>
9-
<SearchPath>..\..\..\Compiler\bin\Release</SearchPath>
9+
<SearchPath>..\..\Compiler</SearchPath>
1010
<WorkingDirectory>.</WorkingDirectory>
1111
<InterpreterId>IronPython|2.7-32</InterpreterId>
1212
<LaunchProvider>IronPython (.NET) launcher</LaunchProvider>
@@ -17,6 +17,7 @@
1717
<SccProvider>SAK</SccProvider>
1818
<SccAuxPath>SAK</SccAuxPath>
1919
<SccLocalPath>SAK</SccLocalPath>
20+
<DebugStdLib>False</DebugStdLib>
2021
</PropertyGroup>
2122
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
2223
<DebugSymbols>true</DebugSymbols>

src/IronPythonWrapper/InferNetExamples/InferNetExamples/InferNetWrapper.py

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import Microsoft.ML.Probabilistic.Collections
2121
import Microsoft.ML.Probabilistic.Factors
2222
import Microsoft.ML.Probabilistic.Math
23+
import Microsoft.ML.Probabilistic.Algorithms
2324
from Microsoft.ML.Probabilistic import *
2425

2526
#---------import all classes and methods from above namespaces-----------
@@ -28,6 +29,9 @@
2829
from Microsoft.ML.Probabilistic.Collections import *
2930
from Microsoft.ML.Probabilistic.Factors import *
3031
from Microsoft.ML.Probabilistic.Math import *
32+
from Microsoft.ML.Probabilistic.Algorithms import *
33+
34+
InferenceEngine.DefaultEngine.Compiler.CompilerChoice = Microsoft.ML.Probabilistic.Compiler.CompilerChoice.Roslyn
3135

3236
#----------------------------------------------------------------------------
3337
#---------------- Variable array helper methos ---------------------------

src/IronPythonWrapper/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Make sure folders containing `InferNetWrapper.py` and Infer.NET binaries are pre
44

55
# Running Tests and Examples
66

7-
* Build `Infer2.sln` using the `Release` configuration, so that Infer.NET binaries will become present in `/Compiler/bin/Release` folder.
8-
* Open `TestWrapper.sln` for tests or `InferNerExamples.sln` for examples.
7+
* Run `SetupCompiler.cmd` script. It runs `dotnet publish` on `Compiler.csproj` and puts the results into `src/IronPythonWrapper/Compiler` folder.
8+
* Open `TestWrapper.sln` for tests or `InferNetExamples.sln` for examples.
99
* Run the only project in the opened solution.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dotnet publish -c ReleaseCore -o ../IronPythonWrapper/Compiler ../Compiler/Compiler.csproj

src/IronPythonWrapper/TestWrapper/TestWrapper/TestWrapper.pyproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ProjectGuid>{9234127e-fbc0-4587-bad9-65727458cc0f}</ProjectGuid>
77
<ProjectHome>.</ProjectHome>
88
<StartupFile>TestWrapper.py</StartupFile>
9-
<SearchPath>..\..\..\Compiler\bin\Release\;..\..\InferNetExamples\InferNetExamples</SearchPath>
9+
<SearchPath>..\..\InferNetExamples\InferNetExamples;..\..\Compiler</SearchPath>
1010
<WorkingDirectory>.</WorkingDirectory>
1111
<InterpreterId>IronPython|2.7-32</InterpreterId>
1212
<LaunchProvider>IronPython (.NET) launcher</LaunchProvider>

0 commit comments

Comments
 (0)