User/brianma/stringbinding (#508)
* update to latest windows AI Nuget packges * add basic TensorString binding support
This commit is contained in:
Родитель
b5157f8441
Коммит
2179a1dd5a
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props" Condition="Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug_NuGet|Win32">
|
||||
<Configuration>Debug_NuGet</Configuration>
|
||||
|
@ -428,16 +429,19 @@
|
|||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets" Condition="Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets')" />
|
||||
</ImportGroup>
|
||||
<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.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.props" Condition="Exists('packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.props')" />
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props" Condition="Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props')" />
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug_NuGet|Win32">
|
||||
<Configuration>Debug_NuGet</Configuration>
|
||||
|
@ -332,19 +332,19 @@
|
|||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.targets" Condition="Exists('packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets" Condition="Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets')" />
|
||||
</ImportGroup>
|
||||
<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.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.8.2\build\Microsoft.AI.DirectML.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.DirectML.1.10.0\build\Microsoft.AI.DirectML.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" />
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug_NuGet|Win32">
|
||||
|
@ -364,7 +364,7 @@
|
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
<Import Project="packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
@ -372,7 +372,7 @@
|
|||
</PropertyGroup>
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.11.0\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.props'))" />
|
||||
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.13.1\build\native\Microsoft.AI.MachineLearning.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AI.DirectML" version="1.8.2" targetFramework="native" />
|
||||
<package id="Microsoft.AI.MachineLearning" version="1.11.0" targetFramework="native" />
|
||||
<package id="Microsoft.AI.DirectML" version="1.10.0" targetFramework="native" />
|
||||
<package id="Microsoft.AI.MachineLearning" version="1.13.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.220608.4" targetFramework="native" />
|
||||
</packages>
|
|
@ -646,6 +646,28 @@ namespace BindingUtilities
|
|||
}
|
||||
}
|
||||
|
||||
TensorString CreateTensorString(const std::vector<int64_t>& tensorShape)
|
||||
{
|
||||
auto length = 1;
|
||||
for (auto&& dim : tensorShape)
|
||||
{
|
||||
if (dim > 0)
|
||||
{
|
||||
length *= dim;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<winrt::hstring> strings;
|
||||
|
||||
for (auto i = 0; i < length; ++i)
|
||||
{
|
||||
auto str = to_hstring(i);
|
||||
strings.push_back(str);
|
||||
}
|
||||
|
||||
return TensorString::CreateFromArray(tensorShape, strings);
|
||||
}
|
||||
|
||||
// Process the descriptor to gather and normalize the shape
|
||||
void ProcessDescriptor(const ILearningModelFeatureDescriptor& description, std::vector<int64_t>& shape,
|
||||
TensorKind& tensorKind, InputBufferDesc& inputBufferDesc)
|
||||
|
@ -851,6 +873,11 @@ namespace BindingUtilities
|
|||
return CreateTensor<TensorKind::UInt64>(args, shape, inputBindingType, inputBufferDesc);
|
||||
}
|
||||
break;
|
||||
case TensorKind::String:
|
||||
{
|
||||
return CreateTensorString(shape);
|
||||
}
|
||||
break;
|
||||
}
|
||||
std::cout << "BindingUtilities: TensorKind has not been implemented." << std::endl;
|
||||
throw hresult_not_implemented();
|
||||
|
|
Загрузка…
Ссылка в новой задаче