Skip to content

Commit

Permalink
Cleanup and commented for CR
Browse files Browse the repository at this point in the history
  • Loading branch information
gaizkan committed Jan 19, 2016
1 parent 2503210 commit d582eb2
Show file tree
Hide file tree
Showing 3 changed files with 207 additions and 187 deletions.
4 changes: 2 additions & 2 deletions Source/CSEvalClient/CSEvalClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<OutputPath>..\..\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -42,7 +42,7 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<OutputPath>..\..\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
Expand Down
59 changes: 34 additions & 25 deletions Source/CSEvalClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,50 @@ class Program
{
private static void Main(string[] args)
{
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, @"..\..\Examples\Image\MNIST\Data\");
Console.WriteLine("Current Directory: {0}", Environment.CurrentDirectory);
try
{
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, @"..\..\Examples\Image\MNIST\Data\");
Console.WriteLine("Current Directory: {0}", Environment.CurrentDirectory);

Console.WriteLine("Creating Model Evaluator...");
var model = new IEvaluateModelManagedF();
Console.WriteLine("Creating Model Evaluator...");
var model = new IEvaluateModelManagedF();

Console.WriteLine("Initializing Model Evaluator...");
string config = GetConfig();
model.Init(config);
Console.WriteLine("Initializing Model Evaluator...");
string config = GetConfig();
model.Init(config);

Console.WriteLine("Loading Model...");
string modelFilePath = Path.Combine(Environment.CurrentDirectory, @"..\Output\Models\01_OneHidden");
model.LoadModel(modelFilePath);
Console.WriteLine("Loading Model...");
string modelFilePath = Path.Combine(Environment.CurrentDirectory, @"..\Output\Models\01_OneHidden");
model.LoadModel(modelFilePath);

var inputs = GetDictionary("features", 28 * 28, 255);
var outputs = GetDictionary("ol.z", 10, 100);
var inputs = GetDictionary("features", 28 * 28, 255);
var outputs = GetDictionary("ol.z", 10, 100);

Console.WriteLine("Press <Enter> to begin evaluating.");
Console.ReadLine();
Console.WriteLine("Press <Enter> to begin evaluating.");
Console.ReadLine();

List<float> outputList = null;
for (int i = 0; i < 10; i++)
{
Console.WriteLine("Evaluating Model...");
outputList = model.Evaluate(inputs, "ol.z", 10); // return results
List<float> outputList = null;
outputList = model.Evaluate(inputs, "ol.z", 10); // return results
model.Evaluate(inputs, outputs); // Pass result structure
}

Console.WriteLine("Destroying Model...");
model.Destroy();
Console.WriteLine("Destroying Model...");
model.Destroy();
model = null;

Console.WriteLine("Output contents:");
foreach (var item in outputs)
Console.WriteLine("Output contents:");
foreach (var item in outputs)
{
Console.WriteLine("Output layer: {0}", item.Key);
foreach (var entry in item.Value)
{
Console.WriteLine(entry);
}
}
}
catch (Exception ex)
{
Console.WriteLine(item);
Console.WriteLine("Error: {0}", ex);
}

Console.WriteLine("Press <Enter> to terminate.");
Expand Down
Loading

0 comments on commit d582eb2

Please sign in to comment.