Add samples for Eval V2
- add device specifier when loading model - rename CPPEvalV2Client to CNTKLibraryCPPEvalExamples - rename CNTKLibraryManagedExamples to CNTKLibraryCSExamples - rename CNTKLibrarymanagedExamples to CNTKLibraryCSExamples - add CNTKLibraryCSEvalGPUExamples and CNTLibraryEvalExamples.sln - complete examples - update project configuraitons - rename program.cs to Program.cs; update packages.config - rename CNTKLibraryCPP/CSExamples to CNTKLibraryCPP/CSEvalexamples - remove AnyCPU - add file header, adapt output message
This commit is contained in:
Родитель
9a3999b165
Коммит
1690fa89f0
2
CNTK.sln
2
CNTK.sln
|
@ -1451,7 +1451,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PerformanceProfilerDll", "S
|
|||
{86883653-8A61-4038-81A0-2379FAE4200A} = {86883653-8A61-4038-81A0-2379FAE4200A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryManagedExamplesTest", "Tests\EndToEndTests\EvalClientTests\CNTKLibraryManagedExamplesTest\CNTKLibraryManagedExamplesTest.csproj", "{3500A847-E024-4E7D-92DD-CC587C17460B}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalExamplesTest", "Tests\EndToEndTests\EvalClientTests\CNTKLibraryCSEvalExamplesTest\CNTKLibraryCSEvalExamplesTest.csproj", "{3500A847-E024-4E7D-92DD-CC587C17460B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// CPPEvalV2Client.cpp : Sample application shows how to evaluate a model using CNTK V2 API.
|
||||
// CNTKLibraryCPPevalExamples.cpp : Sample application shows how to evaluate a model using CNTK V2 API.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
|
@ -7,14 +7,14 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPPEvalV2Client.cpp" />
|
||||
<ClCompile Include="CNTKLibraryCPPEvalExamples.cpp" />
|
||||
<ClCompile Include="EvalMultithreads.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D771A06D-CC25-4582-B5CD-D2A4782BB005}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>CPPEvalV2Client</RootNamespace>
|
||||
<ProjectName>CPPEvalV2Client</ProjectName>
|
||||
<RootNamespace>CNTKLibraryCPPEvalExamples</RootNamespace>
|
||||
<ProjectName>CNTKLibraryCPPEvalExamples</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
@ -15,7 +15,7 @@
|
|||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CPPEvalV2Client.cpp">
|
||||
<ClCompile Include="CNTKLibraryCPPEvalExamples.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EvalMultithreads.cpp">
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamples</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryCSEvalCPUOnlyExamples</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>$(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalCPUOnlyExamples.$(Configuration)\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>$(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalCPUOnlyExamples.$(Configuration)\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CNTKLibraryManaged-2.0, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||
<HintPath>..\packages\CNTK.CPUOnly.2.0-beta8\lib\net45\x64\CNTKLibraryManaged-2.0.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CNTKLibraryCSEvalExamples.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\CNTK.CPUOnly.2.0-beta8\build\net45\CNTK.CPUOnly.targets" Condition="Exists('..\packages\CNTK.CPUOnly.2.0-beta8\build\net45\CNTK.CPUOnly.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\CNTK.CPUOnly.2.0-beta8\build\net45\CNTK.CPUOnly.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CNTK.CPUOnly.2.0-beta8\build\net45\CNTK.CPUOnly.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -2,7 +2,7 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// program.cs -- Example for using C# Eval V2 API.
|
||||
// CNTKLibraryCSEvalExamples.cs -- Examples for using CNTK Library C# Eval API.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
@ -10,13 +10,11 @@ using System.Collections.Generic;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CNTK;
|
||||
|
||||
namespace CNTKLibraryManagedExampleTest
|
||||
namespace CNTKLibraryCSEvalExamples
|
||||
{
|
||||
public class Program
|
||||
public class CNTKLibraryManagedExamples
|
||||
{
|
||||
//
|
||||
// The example shows
|
||||
|
@ -26,13 +24,13 @@ namespace CNTKLibraryManagedExampleTest
|
|||
// - how to evaluate a model.
|
||||
// - how to retrieve evaluation result and retrieve output data in dense format.
|
||||
//
|
||||
static void EvaluationSingleImage(DeviceDescriptor device)
|
||||
public static void EvaluationSingleImage(DeviceDescriptor device)
|
||||
{
|
||||
const string outputName = "Plus2060";
|
||||
var inputDataMap = new Dictionary<Variable, Value>();
|
||||
|
||||
// Load the model.
|
||||
Function modelFunc = Function.LoadModel("z.model");
|
||||
Function modelFunc = Function.LoadModel("z.model", device);
|
||||
|
||||
// Get output variable based on name
|
||||
Variable outputVar = modelFunc.Outputs.Where(variable => string.Equals(variable.Name, outputName)).Single();
|
||||
|
@ -85,13 +83,13 @@ namespace CNTKLibraryManagedExampleTest
|
|||
// - how to evaluate a model.
|
||||
// - how to retrieve evaluation result and retrieve output data in dense format.
|
||||
//
|
||||
static void EvaluationBatchOfImages(DeviceDescriptor device)
|
||||
public static void EvaluationBatchOfImages(DeviceDescriptor device)
|
||||
{
|
||||
const string outputName = "Plus2060";
|
||||
var inputDataMap = new Dictionary<Variable, Value>();
|
||||
|
||||
// Load the model.
|
||||
Function modelFunc = Function.LoadModel("z.model");
|
||||
Function modelFunc = Function.LoadModel("z.model", device);
|
||||
|
||||
// Get output variable based on name
|
||||
Variable outputVar = modelFunc.Outputs.Where(variable => string.Equals(variable.Name, outputName)).Single();
|
||||
|
@ -157,12 +155,12 @@ namespace CNTKLibraryManagedExampleTest
|
|||
// - how to evaluate a model.
|
||||
// - how to retrieve evaluation result and retrieve output data in the one-hot vector format.
|
||||
//
|
||||
static void EvaluationSingleSequenceUsingOneHot(DeviceDescriptor device)
|
||||
public static void EvaluationSingleSequenceUsingOneHot(DeviceDescriptor device)
|
||||
{
|
||||
var vocabToIndex = buildVocabIndex("ATIS.vocab");
|
||||
var indexToVocab = buildInvVocabIndex("ATIS.label");
|
||||
|
||||
Function myFunc = Function.LoadModel("atis.model");
|
||||
Function myFunc = Function.LoadModel("atis.model", device);
|
||||
|
||||
Console.WriteLine("Evaluate single sequence using one-hot vector");
|
||||
|
||||
|
@ -237,12 +235,12 @@ namespace CNTKLibraryManagedExampleTest
|
|||
// - how to evaluate a model.
|
||||
// - how to retrieve evaluation result and retrieve output data in the one-hot vector format.
|
||||
//
|
||||
static void EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor device)
|
||||
public static void EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor device)
|
||||
{
|
||||
var vocabToIndex = buildVocabIndex("ATIS.vocab");
|
||||
var indexToVocab = buildInvVocabIndex("ATIS.label");
|
||||
|
||||
Function myFunc = Function.LoadModel("atis.model");
|
||||
Function myFunc = Function.LoadModel("atis.model", device);
|
||||
|
||||
Console.WriteLine("Evaluate batch of sequences with variable length using one-hot vector");
|
||||
|
||||
|
@ -367,22 +365,5 @@ namespace CNTKLibraryManagedExampleTest
|
|||
{
|
||||
return File.ReadAllLines(filePath);
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("======== Evaluate model using C# ========");
|
||||
|
||||
EvaluationSingleImage(DeviceDescriptor.CPUDevice);
|
||||
EvaluationBatchOfImages(DeviceDescriptor.CPUDevice);
|
||||
//TODO: Add examples with OneHot.
|
||||
//EvaluationSingleSequenceUsingOneHot(DeviceDescriptor.CPUDevice);
|
||||
//EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor.CPUDevice);
|
||||
|
||||
// TODO: using GPU.
|
||||
//EvaluationSingleImage(DeviceDescriptor.GPUDevice(0));
|
||||
//EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0));
|
||||
|
||||
Console.WriteLine("======== Evaluation completes. ========");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// Program.cs -- Example for using CNTK Library C# Eval CPUOnly Nuget Package.
|
||||
//
|
||||
|
||||
using System;
|
||||
using CNTK;
|
||||
|
||||
namespace CNTKLibraryCSEvalExamples
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("======== Evaluate model using C# CPUOnly Build ========");
|
||||
|
||||
CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.CPUDevice);
|
||||
CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.CPUDevice);
|
||||
|
||||
Console.WriteLine("======== Evaluation completes. ========");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CNTKLibraryCSEvalCPUOnlyExamples")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CNTKLibraryCSEvalCPUOnlyExamples")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8aad7322-10b1-48c3-9bc7-005a7910c5e6")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CNTK.CPUOnly" version="2.0-beta8" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{307E5BAC-DA03-45D2-ADEC-FE6620090109}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamples</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryCSEvalGPUExamples</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>$(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalGPUExamples.$(Configuration)\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>$(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalGPUExamples.$(Configuration)\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CNTKLibraryManaged-2.0, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
||||
<HintPath>..\packages\CNTK.GPU.2.0-beta8\lib\net45\x64\CNTKLibraryManaged-2.0.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalExamples.cs">
|
||||
<Link>CNTKLibraryCSEvalExamples.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\CNTK.GPU.2.0-beta8\build\net45\CNTK.GPU.targets" Condition="Exists('..\packages\CNTK.GPU.2.0-beta8\build\net45\CNTK.GPU.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\CNTK.GPU.2.0-beta8\build\net45\CNTK.GPU.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\CNTK.GPU.2.0-beta8\build\net45\CNTK.GPU.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// Program.cs -- Example for using CNTK Library C# Eval GPU Nuget Package.
|
||||
//
|
||||
|
||||
using System;
|
||||
using CNTK;
|
||||
|
||||
namespace CNTKLibraryCSEvalExamples
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("======== Evaluate model using C# GPU Build ========");
|
||||
|
||||
CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.GPUDevice(0));
|
||||
CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0));
|
||||
|
||||
Console.WriteLine("======== Evaluation completes. ========");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CSharpEvalGPUExamples")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CSharpEvalGPUExamples")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("307e5bac-da03-45d2-adec-fe6620090109")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CNTK.GPU" version="2.0-beta8" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CNTKLibraryCPPEvalExamples", "CNTKLibraryCPPEvalExamples\CNTKLibraryCPPEvalExamples.vcxproj", "{D771A06D-CC25-4582-B5CD-D2A4782BB005}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalCPUOnlyExamples", "CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalCPUOnlyExamples.csproj", "{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalGPUExamples", "CNTKLibraryCSEvalGPUExamples\CNTKLibraryCSEvalGPUExamples.csproj", "{307E5BAC-DA03-45D2-ADEC-FE6620090109}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Debug|x64.ActiveCfg = Release|x64
|
||||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.ActiveCfg = Release|x64
|
||||
{D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.Build.0 = Release|x64
|
||||
{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Debug|x64.Build.0 = Debug|x64
|
||||
{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Release|x64.ActiveCfg = Release|x64
|
||||
{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Release|x64.Build.0 = Release|x64
|
||||
{307E5BAC-DA03-45D2-ADEC-FE6620090109}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{307E5BAC-DA03-45D2-ADEC-FE6620090109}.Debug|x64.Build.0 = Debug|x64
|
||||
{307E5BAC-DA03-45D2-ADEC-FE6620090109}.Release|x64.ActiveCfg = Release|x64
|
||||
{307E5BAC-DA03-45D2-ADEC-FE6620090109}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -50,7 +50,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EvalWrapper, Version=0.0.0.0, Culture=neutral, PublicKeyToken=52681d72504348ec, processorArchitecture=AMD64">
|
||||
<HintPath>..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\lib\net45\x64\EvalWrapper.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\lib\net45\x64\EvalWrapper.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
@ -86,11 +86,11 @@
|
|||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets" Condition="Exists('..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets" Condition="Exists('..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\build\net45\Microsoft.Research.CNTK.CpuEval-mkl.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Research.CNTK.CpuEval-mkl" version="2.0-beta7" targetFramework="net45" />
|
||||
<package id="Microsoft.Research.CNTK.CpuEval-mkl" version="2.0-beta8" targetFramework="net45" />
|
||||
</packages>
|
8
Makefile
8
Makefile
|
@ -513,7 +513,7 @@ CNTKLIBRARY_TESTS_SRC =\
|
|||
$(CNTKLIBRARY_TESTS_SRC_PATH)/DeviceSelectionTests.cpp \
|
||||
$(CNTKLIBRARY_TESTS_SRC_PATH)/MinibatchSourceTest.cpp \
|
||||
$(CNTKLIBRARY_TESTS_SRC_PATH)/UserDefinedFunctionTests.cpp \
|
||||
Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp \
|
||||
Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp \
|
||||
|
||||
CNTKLIBRARY_TESTS:=$(BINDIR)/v2librarytests
|
||||
CNTKLIBRARY_TESTS_OBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(patsubst %.cpp, $(OBJDIR)/%.o, $(CNTKLIBRARY_TESTS_SRC)))
|
||||
|
@ -633,11 +633,11 @@ $(EVAL_EXTENDED_CLIENT): $(EVAL_EXTENDED_CLIENT_OBJ) | $(EVAL_LIB) $(READER_LIBS
|
|||
########################################
|
||||
# Eval V2 Sample client
|
||||
########################################
|
||||
EVALV2_SAMPLE_CLIENT:=$(BINDIR)/cppevalv2client
|
||||
EVALV2_SAMPLE_CLIENT:=$(BINDIR)/CNTKLibraryCPPEvalExamples
|
||||
|
||||
EVALV2_SAMPLE_CLIENT_SRC=\
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.cpp \
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp \
|
||||
$(SOURCEDIR)/../Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp
|
||||
|
||||
EVALV2_SAMPLE_CLIENT_OBJ:=$(patsubst %.cpp, $(OBJDIR)/%.o, $(EVALV2_SAMPLE_CLIENT_SRC))
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CNTKLibraryManagedExamplesTest</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryManagedExamplesTest</AssemblyName>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamples</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryCSEvalExamplesTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
|
@ -76,13 +76,11 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryManagedExamples\Program.cs">
|
||||
<Link>Program.cs</Link>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalExamples.cs">
|
||||
<Link>CNTKLibraryCSEvalExamples.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<Target Name="Build" Condition="!Exists('$(SWIG_PATH)\swig.exe')">
|
||||
<Warning Condition="!Exists('$(SWIG_PATH)\swig.exe')" Text="The project requires SWIG to be installed." />
|
||||
</Target>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="Exists('$(SWIG_PATH)\swig.exe')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
|
||||
//
|
||||
// Program.cs -- Tests of CNTK Library C# Eval examples.
|
||||
//
|
||||
|
||||
using System;
|
||||
using CNTK;
|
||||
|
||||
namespace CNTKLibraryCSEvalExamples
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("======== Evaluate model using C# ========");
|
||||
|
||||
CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.CPUDevice);
|
||||
CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.CPUDevice);
|
||||
//TODO: Add examples with OneHot.
|
||||
//EvaluationSingleSequenceUsingOneHot(DeviceDescriptor.CPUDevice);
|
||||
//EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor.CPUDevice);
|
||||
|
||||
// TODO: using GPU.
|
||||
//EvaluationSingleImage(DeviceDescriptor.GPUDevice(0));
|
||||
//EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0));
|
||||
|
||||
Console.WriteLine("======== Evaluation completes. ========");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -114,7 +114,7 @@
|
|||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Examples\Evaluation\CPPEvalV2Client\EvalMultithreads.cpp" />
|
||||
<ClCompile Include="..\..\..\Examples\Evaluation\CNTKLibraryCPPEvalExamples\EvalMultithreads.cpp" />
|
||||
<ClCompile Include="BlockTests.cpp" />
|
||||
<ClCompile Include="CifarResNet.cpp" />
|
||||
<ClCompile Include="Common.cpp" />
|
||||
|
|
|
@ -54,9 +54,6 @@
|
|||
<ClCompile Include="TruncatedLSTMAcousticModel.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Examples\Evaluation\CPPEvalV2Client\EvalMultithreads.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeviceSelectionTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -78,6 +75,9 @@
|
|||
<ClCompile Include="BlockTests.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Examples\Evaluation\CNTKLibraryCPPEvalExamples\EvalMultithreads.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Common.h">
|
||||
|
|
Загрузка…
Ссылка в новой задаче