FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Console/MemoryKerasTest.cs at master · yefuchao/TensorFlow.NET · GitHub
yefuchao
/
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
/
MemoryKerasTest.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (44 loc) · 1.84 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Console
/
MemoryKerasTest.cs
Copy path
File metadata and controls
51 lines (44 loc) · 1.84 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
using
Tensorflow
.
NumPy
;
using
System
;
using
static
Tensorflow
.
Binding
;
using
static
Tensorflow
.
KerasApi
;
namespace
Tensorflow
{
class
MemoryKerasTest
{
public
Action
<
int
,
int
>
Conv2DLayer
=>
(
epoch
,
iterate
)
=>
{
var
input_shape
=
new
int
[
]
{
4
,
512
,
512
,
3
}
;
var
x
=
tf
.
random
.
normal
(
input_shape
)
;
var
conv2d
=
keras
.
layers
.
Conv2D
(
2
,
3
,
activation
:
keras
.
activations
.
Relu
)
;
var
output
=
conv2d
.
Apply
(
x
)
;
}
;
public
Action
<
int
,
int
>
InputLayer
=>
(
epoch
,
iterate
)
=>
{
Shape
shape
=
(
32
,
256
,
256
,
3
)
;
// 48M
var
images
=
np
.
arange
(
shape
.
size
)
.
astype
(
np
.
float32
)
.
reshape
(
shape
.
dims
)
;
var
inputs
=
keras
.
Input
(
(
shape
.
dims
[
1
]
,
shape
.
dims
[
2
]
,
3
)
)
;
var
conv2d
=
keras
.
layers
.
Conv2D
(
32
,
kernel_size
:
(
3
,
3
)
,
activation
:
keras
.
activations
.
Linear
)
;
var
outputs
=
conv2d
.
Apply
(
inputs
)
;
}
;
public
Action
<
int
,
int
>
Prediction
=>
(
epoch
,
iterate
)
=>
{
Shape
shape
=
(
32
,
256
,
256
,
3
)
;
// 48M
var
images
=
np
.
arange
(
shape
.
size
)
.
astype
(
np
.
float32
)
.
reshape
(
shape
.
dims
)
;
var
inputs
=
keras
.
Input
(
(
shape
.
dims
[
1
]
,
shape
.
dims
[
2
]
,
3
)
)
;
var
conv2d
=
keras
.
layers
.
Conv2D
(
32
,
kernel_size
:
(
3
,
3
)
,
activation
:
keras
.
activations
.
Linear
)
.
Apply
(
inputs
)
;
var
flatten
=
keras
.
layers
.
Flatten
(
)
.
Apply
(
inputs
)
;
var
outputs
=
keras
.
layers
.
Dense
(
10
)
.
Apply
(
flatten
)
;
var
model
=
keras
.
Model
(
inputs
,
outputs
,
"prediction"
)
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
model
.
predict
(
images
,
batch_size
:
8
)
;
}
}
;
}
}
Back
|
FazBrowse Home
|
New Git URL