Merge branch 'master' into bowbao/clone_segfault
This commit is contained in:
Коммит
9a075b356c
567
CNTK.sln
567
CNTK.sln
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -86,7 +86,7 @@ def train_and_eval(_base_model_file, _train_image_folder, _test_image_folder, _r
|
|||
|
||||
if not testing:
|
||||
trained_model.save(_new_model_file)
|
||||
print("Stored trained model at %s" % tl_model_file)
|
||||
print("Stored trained model at %s" % _new_model_file)
|
||||
|
||||
# evaluate test images
|
||||
with open(_results_file, 'w') as output_file:
|
||||
|
|
|
@ -2891,7 +2891,7 @@ void CNTKToONNXHelper::CopyAttributes(const FunctionPtr& src, LotusIR::Node* nod
|
|||
auto alpha = (float)src->Attributes()[L"alpha"].Value<double>();
|
||||
auto beta = (float)src->Attributes()[L"beta"].Value<double>();
|
||||
|
||||
node->AddAttribute(attributesMap[L"size"], depthRadius);
|
||||
node->AddAttribute(attributesMap[L"size"], 2*depthRadius + 1);
|
||||
node->AddAttribute(attributesMap[L"bias"], bias);
|
||||
node->AddAttribute(attributesMap[L"alpha"], alpha);
|
||||
node->AddAttribute(attributesMap[L"beta"], beta);
|
||||
|
|
|
@ -2019,14 +2019,12 @@ FunctionPtr ONNXToCNTKHelper::CreateFunction(const Node *node, const std::vector
|
|||
}
|
||||
else if (onnxOpName == "LRN")
|
||||
{
|
||||
// TODO: this is experimental code to load Facebook Caffe models.
|
||||
// Operators are added so hopefully there is not further work needed.
|
||||
size_t depthRadius = GetNamedAttributeAsInt64(node, "size");
|
||||
double bias = GetNamedAttributeAsFloat(node, "bias");
|
||||
double alpha = GetNamedAttributeAsFloat(node, "alpha");
|
||||
double beta = GetNamedAttributeAsFloat(node, "beta");
|
||||
FunctionPtr cntkFunction = LocalResponseNormalization(inputs[0],
|
||||
depthRadius, bias, alpha, beta, ToWString(node->Name()));
|
||||
size_t depthRadius = (GetNamedAttributeAsInt64(node, "size") - 1)/2;
|
||||
double bias = static_cast<double>(GetNamedAttributeAsFloat(node, "bias", 1.0f));
|
||||
double alpha = static_cast<double>(GetNamedAttributeAsFloat(node, "alpha", 1e-4f));
|
||||
double beta = static_cast<double>(GetNamedAttributeAsFloat(node, "beta", 0.75f));
|
||||
FunctionPtr cntkFunction = LocalResponseNormalization(inputs[0],
|
||||
depthRadius, bias, alpha, beta, ToWString(node->Name()));
|
||||
return cntkFunction;
|
||||
}
|
||||
else if (onnxOpName == "AveragePool" || onnxOpName == "MaxPool")
|
||||
|
@ -2394,8 +2392,7 @@ FunctionPtr ONNXToCNTKHelper::CreateFunction(const Node *node, const std::vector
|
|||
}
|
||||
else
|
||||
{
|
||||
int index = static_cast<int>(GetNamedAttributeAsInt64(node, "axis", 0));
|
||||
Axis axis(index - 1);
|
||||
Axis axis(ConvertONNXAxisToCNTKCppApi(static_cast<int>(GetNamedAttributeAsInt64(node, "axis", 0)), inputs[0]));
|
||||
FunctionPtr cntkFunction = Softmax(inputs[0], axis, ToWString(node->Name()));
|
||||
return cntkFunction;
|
||||
}
|
||||
|
@ -2404,15 +2401,7 @@ FunctionPtr ONNXToCNTKHelper::CreateFunction(const Node *node, const std::vector
|
|||
{
|
||||
int index = static_cast<int>(GetNamedAttributeAsInt64(node, "axis", 0));
|
||||
|
||||
Axis axis;
|
||||
if (index == 0)
|
||||
{
|
||||
axis = Axis::DefaultBatchAxis();
|
||||
}
|
||||
else
|
||||
{
|
||||
axis = Axis(index - 1);
|
||||
}
|
||||
Axis axis(ConvertONNXAxisToCNTKCppApi(static_cast<int>(GetNamedAttributeAsInt64(node, "axis", 0)), inputs[0]));
|
||||
|
||||
FunctionPtr cntkFunction = LogSoftmax(inputs[0], axis, ToWString(node->Name()));
|
||||
return cntkFunction;
|
||||
|
|
|
@ -1,94 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" InitialTargets="CheckDependencies" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\..\CNTK.Common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{3500A847-E024-4E7D-92DD-CC587C17460B}</ProjectGuid>
|
||||
<IntermediateOutputPath>$(IntDir)obj\</IntermediateOutputPath>
|
||||
<BaseIntermediateOutputPath>$(IntDir)obj\</BaseIntermediateOutputPath>
|
||||
<OutputPath>$(OutDir)</OutputPath>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutDirPrefix Condition="'$(OutDirPrefix)' == ''">..\..\..\..</OutDirPrefix>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamplesTest</RootNamespace>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<Version>$(CntkVersion)</Version>
|
||||
|
||||
<Authors>Microsoft Corporation</Authors>
|
||||
|
||||
<Copyright>Copyright © $([System.DateTime]::Now.ToString(`yyyy`))</Copyright>
|
||||
|
||||
<OutDir>$(OutDirPrefix)\$(Platform)\$(Configuration)</OutDir>
|
||||
|
||||
<Platforms>x64</Platforms>
|
||||
|
||||
<Configurations>Debug;Debug_CpuOnly;Release;Release_CpuOnly;Release_NoOpt</Configurations>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DebugType>portable</DebugType>
|
||||
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamples</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryCSEvalExamplesTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<WarningsAsErrors />
|
||||
<ApplicationIcon />
|
||||
<OutputType>Exe</OutputType>
|
||||
<StartupObject />
|
||||
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(DebugBuild)">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(ReleaseBuild)">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<!-- The following definitions are needed in order to make the configuration Debug/Debug_CpuOnly live -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_CpuOnly|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CPUONLY</DefineConstants>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug_CpuOnly'">
|
||||
<DefineConstants>DEBUG;TRACE;DEBUG_CPUONLY;CPUONLY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<DefineConstants>RELEASE;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_CpuOnly|x64'">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE;CPUONLY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_NoOpt|x64'">
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release_NoOpt'">
|
||||
<DefineConstants>RELEASE;TRACE</DefineConstants>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release_CpuOnly'">
|
||||
<DefineConstants>RELEASE;TRACE;RELEASE_CPUONLY;CPUONLY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<ProjectReference Include="..\..\..\..\bindings\csharp\CNTKLibraryManagedDll\CNTKLibraryManagedDll.csproj">
|
||||
<Project>{3A09FFE0-7865-4268-8301-73ED64BB75DF}</Project>
|
||||
<Name>CNTKLibraryManagedDll</Name>
|
||||
</ProjectReference>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKExtensions.cs" Link="CNTKExtensions.cs" />
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\ImageExtension\CNTKImageProcessing.cs" Link="CNTKImageProcessing.cs" />
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalExamples.cs" Link="CNTKLibraryCSEvalExamples.cs" />
|
||||
|
||||
<None Remove="App.config" />
|
||||
<Compile Remove="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKExtensions.cs">
|
||||
<Link>CNTKExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\ImageExtension\CNTKImageProcessing.cs">
|
||||
<Link>CNTKImageProcessing.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="MemoryTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SetupMemoryTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalExamples.cs">
|
||||
<Link>CNTKLibraryCSEvalExamples.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="Build" Condition="$(HasSwig)" DependsOnTargets="$(BuildDependsOn)" />
|
||||
<Target Name="CheckDependencies">
|
||||
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
|
||||
</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>
|
||||
<PackageReference Include="CoreCompat.System.Drawing" Version="1.0.0-beta006" />
|
||||
|
||||
<ProjectReference Include="..\..\..\..\bindings\csharp\CNTKLibraryManagedDll\CNTKLibraryManagedDll.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" InitialTargets="CheckDependencies" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="..\..\..\..\CNTK.Common.props" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
|
||||
<ProjectGuid>{3500A847-E024-4E7D-92DD-CC587C17460B}</ProjectGuid>
|
||||
<IntermediateOutputPath>$(IntDir)obj\</IntermediateOutputPath>
|
||||
<BaseIntermediateOutputPath>$(IntDir)obj\</BaseIntermediateOutputPath>
|
||||
<OutputPath>$(OutDir)</OutputPath>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CNTKLibraryCSEvalExamples</RootNamespace>
|
||||
<AssemblyName>CNTKLibraryCSEvalExamplesTest.standard</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(DebugBuild)">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(ReleaseBuild)">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<!-- The following definitions are needed in order to make the configuration Debug/Debug_CpuOnly live -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug_CpuOnly|x64'">
|
||||
<DefineConstants>TRACE;DEBUG;CPUONLY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_CpuOnly|x64'">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>TRACE;CPUONLY</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_NoOpt|x64'">
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<ProjectReference Include="..\..\..\..\bindings\csharp\CNTKLibraryManagedDll\CNTKLibraryManagedDll.csproj">
|
||||
<Project>{3A09FFE0-7865-4268-8301-73ED64BB75DF}</Project>
|
||||
<Name>CNTKLibraryManagedDll</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKExtensions.cs">
|
||||
<Link>CNTKExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\ImageExtension\CNTKImageProcessing.cs">
|
||||
<Link>CNTKImageProcessing.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="MemoryTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SetupMemoryTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\..\..\Examples\Evaluation\CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalExamples.cs">
|
||||
<Link>CNTKLibraryCSEvalExamples.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="Build" Condition="$(HasSwig)" DependsOnTargets="$(BuildDependsOn)" />
|
||||
<Target Name="CheckDependencies">
|
||||
<Warning Condition="!$(HasSwig)" Text="The project requires SWIG to be installed. Please see https://docs.microsoft.com/en-us/cognitive-toolkit/Setup-CNTK-on-Windows#optional-swig for installation instructions." />
|
||||
</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>
|
|
@ -625,7 +625,7 @@ def test_LogSoftmax(tmpdir, dtype):
|
|||
@pytest.mark.parametrize("dtype", DType_Config)
|
||||
def test_LRN(tmpdir, dtype, device_id):
|
||||
if device_id == -1 and dtype == np.float16:
|
||||
pytest.skip('Test is skipped on CPU with float16 data')
|
||||
pytest.skip('Test is skipped on CPU with float16 data, because it uses convolution.')
|
||||
device = cntk_device(device_id)
|
||||
with C.default_options(dtype=dtype):
|
||||
img_shape = (64, 32, 32)
|
||||
|
|
Загрузка…
Ссылка в новой задаче