-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Create API for extracting information about the nodes in a TensorFlow model #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
0e1e2fb
0476b47
f632417
78b0ae4
9669fbe
3702031
1f6a931
478b020
8a9e2c4
bc9fbc1
7ad8de9
b94987d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using Microsoft.ML.Runtime; | ||
| using Microsoft.ML.Runtime.Data; | ||
| using Microsoft.ML.Runtime.Internal.Utilities; | ||
| using Microsoft.ML.Transforms.TensorFlow; | ||
| using System.Linq; | ||
|
|
||
| namespace Microsoft.ML.DnnAnalyzer | ||
| { | ||
| public static class DnnAnalyzer | ||
| { | ||
| public static void Main(string[] args) | ||
| { | ||
| using (var env = new TlcEnvironment()) | ||
| using (var ch = env.Start("DnnAnalyzer")) | ||
| { | ||
| if (Utils.Size(args) != 1) | ||
| { | ||
| ch.Error("Usage: dotnet DnnAnalyzer.dll <model_location>"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
is dll necessary? and should it be dotnet run or just dotnet works? #Closed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "dotnet DnnAnalyzer " didn't work. Is there a different syntax I should try? In reply to: 218189666 [](ancestors = 218189666)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, apparently i need to study dotnet better. dotnet run for projects only, In reply to: 218535326 [](ancestors = 218535326,218189666) |
||
| ch.Done(); | ||
| return; | ||
| } | ||
|
|
||
| foreach (var (name, opType, type, inputs) in TensorFlowUtils.GetModelNodes(args[0])) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I can add more arguments to this app, to let the user filter nodes by operation type (for example, sometimes there are lots of "Const" nodes that users might not be interested in if they are just trying to find the name of a certain layer). Is this valuable? Is having a method that returns this information enough so users can filter programatically, or would user want this as well? |
||
| { | ||
| var inputsString = inputs.Length == 0 ? "" : $", input nodes: {string.Join(", ", inputs)}"; | ||
| ch.Info($"Graph node: '{name}', operation type: '{opType}', output type: '{type}'{inputsString}"); | ||
| } | ||
|
|
||
| ch.Done(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.1</TargetFramework> | ||
| <AssemblyName>DnnAnalyzer</AssemblyName> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be part of TensorFlow package? #Closed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" /> | ||
| <ProjectReference Include="..\..\Microsoft.ML.TensorFlow\Microsoft.ML.TensorFlow.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <NativeAssemblyReference Include="tensorflow" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it feel weird to create environment only to write something to console?
Why can't you just do Console.Writeline? #Resolved