Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
afdcf7d4
Commit
afdcf7d4
authored
Feb 19, 2017
by
Chris Waterson
Committed by
GitHub
Feb 19, 2017
Browse files
Merge pull request #1033 from jameshwang/james/update_swivel_to_1.0
Update swivel to TFr1.0
parents
e3ad49a5
66900a72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
swivel/swivel.py
swivel/swivel.py
+10
-10
No files found.
swivel/swivel.py
View file @
afdcf7d4
...
...
@@ -121,8 +121,8 @@ def count_matrix_input(filenames, submatrix_rows, submatrix_cols):
sparse_local_col
=
features
[
'sparse_local_col'
].
values
sparse_count
=
features
[
'sparse_value'
].
values
sparse_indices
=
tf
.
concat
(
1
,
[
tf
.
expand_dims
(
sparse_local_row
,
1
),
tf
.
expand_dims
(
sparse_local_col
,
1
)])
sparse_indices
=
tf
.
concat
([
tf
.
expand_dims
(
sparse_local_row
,
1
),
tf
.
expand_dims
(
sparse_local_col
,
1
)]
,
1
)
count
=
tf
.
sparse_to_dense
(
sparse_indices
,
[
submatrix_rows
,
submatrix_cols
],
sparse_count
)
...
...
@@ -217,8 +217,8 @@ class SwivelModel(object):
embedding_dim
=
config
.
embedding_size
,
vocab_size
=
self
.
n_cols
,
name
=
'col_embedding'
)
tf
.
histogram
_summary
(
'row_emb'
,
self
.
row_embedding
)
tf
.
histogram
_summary
(
'col_emb'
,
self
.
col_embedding
)
tf
.
summary
.
histogram
(
'row_emb'
,
self
.
row_embedding
)
tf
.
summary
.
histogram
(
'col_emb'
,
self
.
col_embedding
)
matrix_log_sum
=
math
.
log
(
np
.
sum
(
row_sums
)
+
1
)
row_bias_init
=
[
math
.
log
(
x
+
1
)
for
x
in
row_sums
]
...
...
@@ -227,8 +227,8 @@ class SwivelModel(object):
trainable
=
config
.
trainable_bias
)
self
.
col_bias
=
tf
.
Variable
(
col_bias_init
,
trainable
=
config
.
trainable_bias
)
tf
.
histogram
_summary
(
'row_bias'
,
self
.
row_bias
)
tf
.
histogram
_summary
(
'col_bias'
,
self
.
col_bias
)
tf
.
summary
.
histogram
(
'row_bias'
,
self
.
row_bias
)
tf
.
summary
.
histogram
(
'col_bias'
,
self
.
col_bias
)
# ===== CREATE GRAPH =====
...
...
@@ -275,9 +275,9 @@ class SwivelModel(object):
self
.
loss
=
l2_loss
+
sigmoid_loss
tf
.
s
calar_summary
(
"l2_loss"
,
l2_loss
)
tf
.
s
calar_summary
(
"sigmoid_loss"
,
sigmoid_loss
)
tf
.
s
calar_summary
(
"loss"
,
self
.
loss
)
tf
.
s
ummary
.
scalar
(
"l2_loss"
,
l2_loss
)
tf
.
s
ummary
.
scalar
(
"sigmoid_loss"
,
sigmoid_loss
)
tf
.
s
ummary
.
scalar
(
"loss"
,
self
.
loss
)
# Add optimizer.
self
.
global_step
=
tf
.
Variable
(
0
,
name
=
'global_step'
)
...
...
@@ -302,7 +302,7 @@ def main(_):
sess
=
tf
.
Session
(
config
=
tf
.
ConfigProto
(
gpu_options
=
gpu_options
))
# Run the Op to initialize the variables.
sess
.
run
(
tf
.
initialize_
al
l
_variables
())
sess
.
run
(
tf
.
glob
al_variables
_initializer
())
# Start feeding input
coord
=
tf
.
train
.
Coordinator
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment