Skip to content

Add TensorFlow documentation to the main class, and include examples on it. #867

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

Merged
merged 8 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/Microsoft.ML.TensorFlow/TensorflowTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

namespace Microsoft.ML.Transforms
{
/// <include file='doc.xml' path='doc/members/member[@name="TensorflowTransform"]/*' />
public sealed class TensorFlowTransform : ITransformer, ICanSaveModel
{
public sealed class Arguments : TransformInputBase
Expand Down Expand Up @@ -61,10 +62,10 @@ public sealed class Arguments : TransformInputBase
public readonly string[] Outputs;

public static int BatchSize = 1;
public const string Summary = "Transforms the data using the TensorFlow model.";
public const string UserName = "TensorFlowTransform";
public const string ShortName = "TFTransform";
public const string LoaderSignature = "TensorFlowTransform";
internal const string Summary = "Transforms the data using the TensorFlow model.";
internal const string UserName = "TensorFlowTransform";
internal const string ShortName = "TFTransform";
internal const string LoaderSignature = "TensorFlowTransform";

private static VersionInfo GetVersionInfo()
{
Expand Down Expand Up @@ -509,7 +510,12 @@ public TFTensor GetTensor()
}
}

[TlcModule.EntryPoint(Name = "Transforms.TensorFlowScorer", Desc = Summary, UserName = UserName, ShortName = ShortName)]
[TlcModule.EntryPoint(Name = "Transforms.TensorFlowScorer",
Desc = Summary,
UserName = UserName,
ShortName = ShortName,
XmlInclude = new[] { @"<include file='../Microsoft.ML.TensorFlow/doc.xml' path='doc/members/member[@name=""TensorflowTransform""]/*' />",
@"<include file='../Microsoft.ML.TensorFlow/doc.xml' path='doc/members/example[@name=""TensorflowTransform""]/*' />" })]
public static CommonOutputs.TransformOutput TensorFlowScorer(IHostEnvironment env, Arguments input)
{
Contracts.CheckValue(env, nameof(env));
Expand Down
8 changes: 3 additions & 5 deletions src/Microsoft.ML.TensorFlow/doc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<member name="TensorflowTransform">
<summary>
Extracts hidden layers' values from a pre-trained Tensorflow model.
Extracts hidden layers&apos; values from a pre-trained Tensorflow model.
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Sep 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

' [](start = 30, length = 6)

is it even necessary? #Pending

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XML requires to escap: ', ", <, >, & characters.

To my surprise, this was displaying fine, but i have had trouble with the rest of them. Changed it for consistency.


In reply to: 216144446 [](ancestors = 216144446)

</summary>
<remarks>
<para>
Expand Down Expand Up @@ -44,12 +44,10 @@
</a>.

</remarks>
</member>
<example name="TensorflowTransform">
<example>
<code language="csharp">
pipeline.Add(new TextLoader(dataFile).CreateFrom&lt;MNISTData&gt;(useHeader: false));
pipeline.Add(new ColumnCopier(("NumericImageVec", "Input");
pipeline.Add(new ColumnCopier((&quot;NumericImageVec&quot;, &quot;Input&quot;);
pipeline.Add(new TensorFlowScorer()
{
ModelFile = model_location;
Expand Down Expand Up @@ -87,8 +85,8 @@
OutputColumns = &quot;Output&quot;
});
</code>
</example>
</example>
</member>

</members>
</doc>
5 changes: 2 additions & 3 deletions src/Microsoft.ML/CSharpApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15777,9 +15777,8 @@ public SentimentAnalyzerPipelineStep(Output output)
namespace Transforms
{

/// <summary>
/// Transforms the data using the TensorFlow model.
/// </summary>
/// <include file='../Microsoft.ML.TensorFlow/doc.xml' path='doc/members/member[@name="TensorflowTransform"]/*' />
/// <include file='../Microsoft.ML.TensorFlow/doc.xml' path='doc/members/example[@name="TensorflowTransform"]/*' />
Copy link
Contributor

@zeahmed zeahmed Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'doc/members/example [](start = 68, length = 20)

I see that example tag is under member tag. It's not immediately under members. Will it work?

My understanding is that if we are doing
/// <include file='../Microsoft.ML.TensorFlow/doc.xml' path='doc/members/member[@name="TensorflowTransform"]/*' />

Everything including example will also be copied here. #Resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Zeeshan.


In reply to: 216475085 [](ancestors = 216475085)

public sealed partial class TensorFlowScorer : Microsoft.ML.Runtime.EntryPoints.CommonInputs.ITransformInput, Microsoft.ML.ILearningPipelineItem
{

Expand Down