Skip to content

Commit 7ceaae8

Browse files
committed
Small touchups
1 parent f9a6d4e commit 7ceaae8

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

Examples/ExampleInceptionInference/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public static void Main (string [] args)
9696
// accepts batches of image data as input.
9797
var tensor = CreateTensorFromImageFile (file);
9898

99-
var output = session.Run (inputs: new [] { graph ["input"] [0] },
100-
inputValues: new [] { tensor },
101-
outputs: new [] { graph ["output"] [0] });
99+
var runner = session.GetRunner ();
100+
runner.AddInput (graph ["input"] [0], tensor).Fetch (graph ["output"] [0]);
101+
var output = runner.Run ();
102102
// output[0].Value() is a vector containing probabilities of
103103
// labels for each image in the "batch". The batch size was 1.
104104
// Find the most probably label index.

Examples/FExampleInceptionInference/Program.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@ let main argv =
9191
let tensor = createTensorFromImageFile file
9292

9393
// Run the session
94-
let sessionOutput = session.Run (inputs = [| graph.["input"].[0] |], inputValues= [| tensor |], outputs = [| graph.["output"].[0] |])
94+
let runner = session.GetRunner ();
95+
runner.AddInput (graph.["input"].[0], tensor)
96+
runner.Fetch (graph.["output"].[0]);
97+
let sessionOutput = runner.Run ();
98+
99+
//
100+
// Other style of invoking the runner:
101+
// let sessionOutput = session.Run (inputs = [| graph.["input"].[0] |], inputValues= [| tensor |], outputs = [| graph.["output"].[0] |])
102+
//
95103
let resultTensor = sessionOutput.[0]
96104

97105
// The GetValue method returns an 'object' type, we need to cast this

OpGenerator/OpGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ MemoryStream GetOpsList ()
397397
void Run ()
398398
{
399399

400-
output = File.CreateText ("../../../TensorFlowSharp/Operations.cs");
400+
output = File.CreateText ("../../../TensorFlowSharp/Operations.g.cs");
401401
var operations = Serializer.Deserialize<List<OpDef>> (GetOpsList ());
402402
p ("using System;\n");
403403

SampleTest/SampleTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public void Dispose ()
289289
void ExpectMeta (TFOperation op, string name, int expectedListSize, TFAttributeType expectedType, int expectedTotalSize)
290290
{
291291
var meta = op.GetAttributeMetadata (name);
292-
Assert (meta.IsList == (expectedListSize >= 0 ? 1 : 0));
292+
Assert (meta.IsList == (expectedListSize >= 0 ? true : false));
293293
Assert (expectedListSize == meta.ListSize);
294294
Assert (expectedTotalSize == expectedTotalSize);
295295
Assert (expectedType == meta.Type);

TensorFlowSharp/TensorFlowSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<ItemGroup>
3636
<Compile Include="Tensorflow.cs" />
3737
<Compile Include="Properties\AssemblyInfo.cs" />
38-
<Compile Include="Operations.cs" />
38+
<Compile Include="Operations.g.cs" />
3939
<Compile Include="OperationsExtras.cs" />
4040
<Compile Include="Buffer.cs" />
4141
<Compile Include="Tensor.cs" />

0 commit comments

Comments
 (0)