diff options
Diffstat (limited to 'runtimes/contrib/TFLiteSharp/TFLiteSharpTest')
3 files changed, 81 insertions, 0 deletions
diff --git a/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest.sln b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest.sln new file mode 100644 index 000000000..e260a72c7 --- /dev/null +++ b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TFLiteSharpTest", "TFLiteSharpTest\TFLiteSharpTest.csproj", "{D35A178F-9EF3-4B07-9E53-A91AA7A030B3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TFLiteSharp", "..\TFLiteSharp\TFLiteSharp\TFLiteSharp.csproj", "{C06BC425-9BC3-43C7-A9D3-E12849E0C129}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D35A178F-9EF3-4B07-9E53-A91AA7A030B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D35A178F-9EF3-4B07-9E53-A91AA7A030B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D35A178F-9EF3-4B07-9E53-A91AA7A030B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D35A178F-9EF3-4B07-9E53-A91AA7A030B3}.Release|Any CPU.Build.0 = Release|Any CPU + {C06BC425-9BC3-43C7-A9D3-E12849E0C129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C06BC425-9BC3-43C7-A9D3-E12849E0C129}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C06BC425-9BC3-43C7-A9D3-E12849E0C129}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C06BC425-9BC3-43C7-A9D3-E12849E0C129}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8F946511-2BE4-40A5-A48C-A5684C62755D} + EndGlobalSection +EndGlobal diff --git a/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/Program.cs b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/Program.cs new file mode 100644 index 000000000..e559bec36 --- /dev/null +++ b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/Program.cs @@ -0,0 +1,38 @@ +using System; + +namespace TFLiteSharpTest +{ + class Program + { + static void Main(string[] args) + { + //Constructing a new interpreter instance from the modelfile + TFLite.Interpreter interpreter = new TFLite.Interpreter("modelpath/modelfile.tflite"); + Console.WriteLine("Interpreter Built Successfully"); + + //Setting the number of threads of the interpreter + interpreter.SetNumThreads(1); + + //Declaring input and output variables; + Array input = new int[5] { 1, 2, 3, 4, 5 }; + Array output = new int[5]; + + //Call to invoke the interpreter and run the inference to populate output + interpreter.Run(input, out output); + Console.WriteLine("Output generated Successfully"); + + //get input, output indices + Console.WriteLine("Input index for tensorname: " + interpreter.GetInputIndex("tensorname")); + Console.WriteLine("Output index for tensorname: " + interpreter.GetOutputIndex("tensorname")); + + //Resizing the dimensions + int[] dims = new int[3] { 1, 2, 3 }; + interpreter.ResizeInput(1, dims); + + //Disposing the interpreter to free resources at the end + interpreter.Dispose(); + + Console.WriteLine("Run Complete"); + } + } +} diff --git a/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/TFLiteSharpTest.csproj b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/TFLiteSharpTest.csproj new file mode 100644 index 000000000..b143ee598 --- /dev/null +++ b/runtimes/contrib/TFLiteSharp/TFLiteSharpTest/TFLiteSharpTest/TFLiteSharpTest.csproj @@ -0,0 +1,12 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>netcoreapp2.0</TargetFramework> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\..\TFLiteSharp\TFLiteSharp\TFLiteSharp.csproj" /> + </ItemGroup> + +</Project> |