File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,37 @@ using (var session = new TFSession())
9191 Console .WriteLine (" a*b={0}" , multiplyResultValue );
9292}
9393```
94+ Here is an F# scripting version of the same example, you can use this in F# Interactive:
95+ ```
96+ #r @"packages\TensorFlowSharp.1.2.2\lib\net461\TensorFlowSharp.dll"
97+
98+ open System
99+ open System.IO
100+ open TensorFlow
101+
102+ // set the path to find the native DLL
103+ Environment.SetEnvironmentVariable("Path",
104+ Environment.GetEnvironmentVariable("Path") + ";" + __SOURCE_DIRECTORY__ + @"/packages/TensorFlowSharp.1.2.2/native")
105+
106+ module AddTwoNumbers =
107+ let session = new TFSession()
108+ let graph = session.Graph
109+
110+ let a = graph.Const(new TFTensor(2))
111+ let b = graph.Const(new TFTensor(3))
112+ Console.WriteLine("a=2 b=3")
113+
114+ // Add two constants
115+ let addingResults = session.GetRunner().Run(graph.Add(a, b))
116+ let addingResultValue = addingResults.GetValue()
117+ Console.WriteLine("a+b={0}", addingResultValue)
118+
119+ // Multiply two constants
120+ let multiplyResults = session.GetRunner().Run(graph.Mul(a, b))
121+ let multiplyResultValue = multiplyResults.GetValue()
122+ Console.WriteLine("a*b={0}", multiplyResultValue)
123+ ```
124+
94125
95126# Working on TensorFlowSharp
96127
You can’t perform that action at this time.
0 commit comments