FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Console/Program.cs at master · tarekgh/TensorFlow.NET · GitHub
tarekgh
/
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
/
src
/
TensorFlowNET.Console
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
93 lines (67 loc) · 2.45 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Console
/
Program.cs
Copy path
File metadata and controls
93 lines (67 loc) · 2.45 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using
System
;
using
static
Tensorflow
.
Binding
;
namespace
Tensorflow
{
class
Program
{
static
void
Main
(
string
[
]
args
)
{
var
diag
=
new
Diagnostician
(
)
;
// diag.Diagnose(@"D:\memory.txt");
// this class is used explor new features.
var
exploring
=
new
Exploring
(
)
;
// exploring.Run();
// boot .net core 10.5M.
var
mm
=
new
MemoryMonitor
(
)
;
// warm up tensorflow.net 37.3M.
mm
.
WarmUp
(
)
;
BasicTest
(
mm
)
;
KerasTest
(
mm
)
;
FuncGraph
(
mm
)
;
// 65M
Console
.
WriteLine
(
"Finished."
)
;
Console
.
ReadLine
(
)
;
}
static
void
BasicTest
(
MemoryMonitor
mm
)
{
int
batchSize
=
1000
;
var
basic
=
new
MemoryBasicTest
(
)
;
// 1 million placeholder
/*tf.compat.v1.disable_eager_execution();
mm.Execute(10, 100 * batchSize, basic.Placeholder);
tf.enable_eager_execution();*/
// 1 million tensor
mm
.
Execute
(
10
,
100
*
batchSize
,
basic
.
Constant
)
;
// explaination of constant
mm
.
Execute
(
10
,
100
*
batchSize
,
basic
.
Constant2x3
)
;
mm
.
Execute
(
10
,
batchSize
,
basic
.
ConstantString
)
;
// 100K float variable.
mm
.
Execute
(
10
,
batchSize
,
basic
.
Variable
)
;
mm
.
Execute
(
10
,
batchSize
,
basic
.
VariableRead
)
;
mm
.
Execute
(
10
,
batchSize
,
basic
.
VariableAssign
)
;
// 1 million math.
mm
.
Execute
(
10
,
100
*
batchSize
,
basic
.
MathAdd
)
;
// Conv2d in constant tensor
mm
.
Execute
(
10
,
batchSize
,
basic
.
Conv2DWithTensor
)
;
// Conv2d in variable
mm
.
Execute
(
10
,
batchSize
,
basic
.
Conv2DWithVariable
)
;
// 100K gradient 44M.
mm
.
Execute
(
10
,
10
*
batchSize
,
basic
.
Gradient
)
;
// memory leak when increasing the epoch
mm
.
Execute
(
10
,
10
,
basic
.
Dataset
)
;
}
static
void
KerasTest
(
MemoryMonitor
mm
)
{
var
keras
=
new
MemoryKerasTest
(
)
;
// +1M (10,50)
mm
.
Execute
(
10
,
1
,
keras
.
Conv2DLayer
)
;
mm
.
Execute
(
10
,
50
,
keras
.
InputLayer
)
;
mm
.
Execute
(
10
,
10
,
keras
.
Prediction
)
;
}
static
void
FuncGraph
(
MemoryMonitor
mm
)
{
var
func
=
new
MemoryFuncGraphTest
(
)
;
mm
.
Execute
(
10
,
100
,
func
.
ConcreteFunction
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL