FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/test/TensorFlowNET.Examples/BasicEagerApi.cs at master · weinre/TensorFlow.NET · GitHub
weinre
/
TensorFlow.NET
Public
forked from
SciSharp/TensorFlow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TensorFlow.NET
/
test
/
TensorFlowNET.Examples
/
BasicEagerApi.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (41 loc) · 1.34 KB
Breadcrumbs
TensorFlow.NET
/
test
/
TensorFlowNET.Examples
/
BasicEagerApi.cs
Copy path
File metadata and controls
49 lines (41 loc) · 1.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Text
;
using
Tensorflow
;
namespace
TensorFlowNET
.
Examples
{
/// <summary>
/// Basic introduction to TensorFlow's Eager API.
/// https://github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/1_Introduction/basic_eager_api.py
/// </summary>
public
class
BasicEagerApi
:
IExample
{
public
int
Priority
=>
100
;
public
bool
Enabled
=>
false
;
public
string
Name
=>
"Basic Eager"
;
private
Tensor
a
,
b
,
c
,
d
;
public
bool
Run
(
)
{
// Set Eager API
Console
.
WriteLine
(
"Setting Eager mode..."
)
;
tf
.
enable_eager_execution
(
)
;
// Define constant tensors
Console
.
WriteLine
(
"Define constant tensors"
)
;
a
=
tf
.
constant
(
2
)
;
Console
.
WriteLine
(
$
"a =
{
a
}
"
)
;
b
=
tf
.
constant
(
3
)
;
Console
.
WriteLine
(
$
"b =
{
b
}
"
)
;
// Run the operation without the need for tf.Session
Console
.
WriteLine
(
"Running operations, without tf.Session"
)
;
c
=
a
+
b
;
Console
.
WriteLine
(
$
"a + b =
{
c
}
"
)
;
d
=
a
*
b
;
Console
.
WriteLine
(
$
"a * b =
{
d
}
"
)
;
// Full compatibility with Numpy
return
true
;
}
public
void
PrepareData
(
)
{
}
}
}
Back
|
FazBrowse Home
|
New Git URL