FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/test/TensorFlowNET.Examples/MetaGraph.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
/
MetaGraph.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (36 loc) · 1.2 KB
Breadcrumbs
TensorFlow.NET
/
test
/
TensorFlowNET.Examples
/
MetaGraph.cs
Copy path
File metadata and controls
40 lines (36 loc) · 1.2 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
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
IO
;
using
System
.
Runtime
.
InteropServices
;
using
System
.
Text
;
using
Tensorflow
;
namespace
TensorFlowNET
.
Examples
{
public
class
MetaGraph
:
Python
,
IExample
{
public
int
Priority
=>
100
;
public
bool
Enabled
=>
false
;
public
string
Name
=>
"Meta Graph"
;
public
bool
Run
(
)
{
ImportMetaGraph
(
"my-save-dir/"
)
;
return
false
;
}
private
void
ImportMetaGraph
(
string
dir
)
{
with
(
tf
.
Session
(
)
,
sess
=>
{
var
new_saver
=
tf
.
train
.
import_meta_graph
(
dir
+
"my-model-10000.meta"
)
;
new_saver
.
restore
(
sess
,
dir
+
"my-model-10000"
)
;
var
labels
=
tf
.
constant
(
0
,
dtype
:
tf
.
int32
,
shape
:
new
int
[
]
{
100
}
,
name
:
"labels"
)
;
var
batch_size
=
tf
.
size
(
labels
)
;
var
logits
=
(
tf
.
get_collection
(
"logits"
)
as
List
<
ITensorOrOperation
>
)
[
0
]
as
Tensor
;
var
loss
=
tf
.
losses
.
sparse_softmax_cross_entropy
(
labels
:
labels
,
logits
:
logits
)
;
}
)
;
}
public
void
PrepareData
(
)
{
}
}
}
Back
|
FazBrowse Home
|
New Git URL