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
25f13fa9
Commit
25f13fa9
authored
Jun 03, 2019
by
guptapriya
Committed by
guptapriya
Jun 03, 2019
Browse files
fix lint issues
parent
3d2a7e7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
official/recommendation/ncf_keras_main.py
official/recommendation/ncf_keras_main.py
+3
-3
No files found.
official/recommendation/ncf_keras_main.py
View file @
25f13fa9
...
@@ -63,7 +63,7 @@ class MetricLayer(tf.keras.layers.Layer):
...
@@ -63,7 +63,7 @@ class MetricLayer(tf.keras.layers.Layer):
super
(
MetricLayer
,
self
).
__init__
()
super
(
MetricLayer
,
self
).
__init__
()
self
.
params
=
params
self
.
params
=
params
self
.
metric
=
tf
.
keras
.
metrics
.
Mean
(
name
=
rconst
.
HR_METRIC_NAME
)
self
.
metric
=
tf
.
keras
.
metrics
.
Mean
(
name
=
rconst
.
HR_METRIC_NAME
)
def
call
(
self
,
inputs
):
def
call
(
self
,
inputs
):
logits
,
dup_mask
=
inputs
logits
,
dup_mask
=
inputs
in_top_k
,
metric_weights
=
metric_fn
(
logits
,
dup_mask
,
self
.
params
)
in_top_k
,
metric_weights
=
metric_fn
(
logits
,
dup_mask
,
self
.
params
)
...
@@ -185,7 +185,7 @@ def _get_keras_model(params):
...
@@ -185,7 +185,7 @@ def _get_keras_model(params):
batch_size
=
params
[
"batches_per_step"
],
batch_size
=
params
[
"batches_per_step"
],
name
=
movielens
.
ITEM_COLUMN
,
name
=
movielens
.
ITEM_COLUMN
,
dtype
=
tf
.
int32
)
dtype
=
tf
.
int32
)
valid_pt_mask_input
=
tf
.
keras
.
layers
.
Input
(
valid_pt_mask_input
=
tf
.
keras
.
layers
.
Input
(
shape
=
(
batch_size
,),
shape
=
(
batch_size
,),
batch_size
=
params
[
"batches_per_step"
],
batch_size
=
params
[
"batches_per_step"
],
...
@@ -340,7 +340,7 @@ def run_ncf(_):
...
@@ -340,7 +340,7 @@ def run_ncf(_):
features
,
_
=
inputs
features
,
_
=
inputs
softmax_logits
=
keras_model
(
features
)
softmax_logits
=
keras_model
(
features
)
in_top_k
,
metric_weights
=
metric_fn
(
in_top_k
,
metric_weights
=
metric_fn
(
softmax_logits
,
features
[
rconst
.
DUPLICATE_MASK
],
params
)
softmax_logits
,
features
[
rconst
.
DUPLICATE_MASK
],
params
)
hr_sum
=
tf
.
reduce_sum
(
in_top_k
*
metric_weights
)
hr_sum
=
tf
.
reduce_sum
(
in_top_k
*
metric_weights
)
hr_count
=
tf
.
reduce_sum
(
metric_weights
)
hr_count
=
tf
.
reduce_sum
(
metric_weights
)
return
hr_sum
,
hr_count
return
hr_sum
,
hr_count
...
...
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