Skip to content

Commit a57c593

Browse files
committed
Scopes, TFTensor constructors
1 parent 39e1278 commit a57c593

4 files changed

Lines changed: 637 additions & 494 deletions

File tree

Examples/FExampleInceptionInference/Program.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// mono FExampleInceptionInference file1.JPG file2.jpg...
44
//
55
// Things to improve in the F# API
6-
// Need TFTensor constructors for the sake of F# as it does not use the implicit constructors
76
// The C# Nullables are not surfaced in a way that makes it nice for F#, must manually call System.Nullable on it
87
//
98
open TensorFlow
@@ -34,10 +33,10 @@ let FetchModelFiles =
3433

3534
// Convenience functiosn to create tensor constants from an integer and a float
3635
let iconst (graph:TFGraph) (v:int) (label:string) =
37-
graph.Const (TFTensor.op_Implicit (v), label)
36+
graph.Const (new TFTensor (v), label)
3837

3938
let fconst (graph:TFGraph) (v:float32) (label:string) =
40-
graph.Const (TFTensor.op_Implicit (v), label)
39+
graph.Const (new TFTensor (v), label)
4140

4241
// The inception model takes as input the image described by a Tensor in a very
4342
// specific normalized format (a particular image size, shape of the input tensor,

OpGenerator/OpGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void Generate (OpDef oper)
300300
p ($"public {retType} {name} ({FillArguments(oper)}string operName = null)");
301301
pi ("{");
302302
bool needStatus = required_attrs.Concat (optional_attrs).Any (attr => attr.type.Contains ("TFTensor"));
303-
p ($"var desc = new TFOperationDesc (this, \"{oper.name}\", operName == null ? \"{oper.name}\" : operName);");
303+
p ($"var desc = new TFOperationDesc (this, \"{oper.name}\", MakeName (\"{oper.name}\", operName));");
304304
foreach (var arg in oper.input_arg) {
305305
if (IsListArg (arg))
306306
p ($"desc.AddInputs ({ParamMap (arg.name)});");

0 commit comments

Comments
 (0)